<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Number of rows in straight table used in calculation condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Number-of-rows-in-straight-table-used-in-calculation-condition/m-p/33918#M5741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing with a question on how we can get the total number of rows in straight table and use that as part of calculation condition? Basically, I want to be able to limit the straight table to only show if there are 50K or less rows in that straight table not on my result set after filters (elaborated on Dynamic table sub-point) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 tables where I want to implement this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Static table - dimensions and expressions are static. This has 8 dimensions.&lt;/LI&gt;&lt;LI&gt;Dynamic table - user has the ability to choose what dimensions or expressions they want to display, can go up from 1 to 32 dimensions.&lt;OL&gt;&lt;LI&gt;Using just the number of rows returned by filters will not work in this situation in the case where a user selects dimensions and only returns 2 values, I want to still show that even if the dataset rows is still &amp;gt;50000 after any filters applied.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Things I've tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;NoOfRows(TOTAL) - this doesn't seem to return the total number of rows when used outside of the expressions tab of that table so doing NoOfRows(TOTAL) &amp;lt;=50000 on the calculation condition doesn't work.&lt;/LI&gt;&lt;LI&gt;RowNo() - or other variations of this function also doesn't work for my use-case, pretty much same as NoOfRows&lt;OL&gt;&lt;LI&gt;Also tried using it in the script to put a row number for my records, doesn't really work for me because of the scenario mentions in the Dynamic table sub-point.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Count(Distinct dimension1 &amp;amp; ... &amp;amp; dimensionN) - this one works for the static table although I notice significant slow down with 8 dimensions being processed.&lt;OL&gt;&lt;LI&gt;I tried this same logic for the dynamic table but QlikView crashes due to lack of memory, I imagine because of the number of fields I try to concatenate (32).&lt;OL&gt;&lt;LI&gt;Syntax: count(DISTINCT $(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 1)) &amp;amp; ... &amp;amp; &lt;SPAN style="font-size: 13.3333px;"&gt;$(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 32)))&lt;/SPAN&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Where &lt;SPAN style="font-size: 13.3333px;"&gt;$(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 1))&amp;nbsp; is my calculated dimension used on the straight table.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much in advance,&lt;/P&gt;&lt;P&gt;Roebrich Perez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Mar 2018 21:01:05 GMT</pubDate>
    <dc:creator>roebrich</dc:creator>
    <dc:date>2018-03-29T21:01:05Z</dc:date>
    <item>
      <title>Number of rows in straight table used in calculation condition</title>
      <link>https://community.qlik.com/t5/QlikView/Number-of-rows-in-straight-table-used-in-calculation-condition/m-p/33918#M5741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing with a question on how we can get the total number of rows in straight table and use that as part of calculation condition? Basically, I want to be able to limit the straight table to only show if there are 50K or less rows in that straight table not on my result set after filters (elaborated on Dynamic table sub-point) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 tables where I want to implement this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Static table - dimensions and expressions are static. This has 8 dimensions.&lt;/LI&gt;&lt;LI&gt;Dynamic table - user has the ability to choose what dimensions or expressions they want to display, can go up from 1 to 32 dimensions.&lt;OL&gt;&lt;LI&gt;Using just the number of rows returned by filters will not work in this situation in the case where a user selects dimensions and only returns 2 values, I want to still show that even if the dataset rows is still &amp;gt;50000 after any filters applied.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Things I've tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;NoOfRows(TOTAL) - this doesn't seem to return the total number of rows when used outside of the expressions tab of that table so doing NoOfRows(TOTAL) &amp;lt;=50000 on the calculation condition doesn't work.&lt;/LI&gt;&lt;LI&gt;RowNo() - or other variations of this function also doesn't work for my use-case, pretty much same as NoOfRows&lt;OL&gt;&lt;LI&gt;Also tried using it in the script to put a row number for my records, doesn't really work for me because of the scenario mentions in the Dynamic table sub-point.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Count(Distinct dimension1 &amp;amp; ... &amp;amp; dimensionN) - this one works for the static table although I notice significant slow down with 8 dimensions being processed.&lt;OL&gt;&lt;LI&gt;I tried this same logic for the dynamic table but QlikView crashes due to lack of memory, I imagine because of the number of fields I try to concatenate (32).&lt;OL&gt;&lt;LI&gt;Syntax: count(DISTINCT $(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 1)) &amp;amp; ... &amp;amp; &lt;SPAN style="font-size: 13.3333px;"&gt;$(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 32)))&lt;/SPAN&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Where &lt;SPAN style="font-size: 13.3333px;"&gt;$(=SubField(concat(distinct Dimension,&amp;nbsp; '|',&amp;nbsp; DimensionID), '|', 1))&amp;nbsp; is my calculated dimension used on the straight table.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much in advance,&lt;/P&gt;&lt;P&gt;Roebrich Perez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2018 21:01:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Number-of-rows-in-straight-table-used-in-calculation-condition/m-p/33918#M5741</guid>
      <dc:creator>roebrich</dc:creator>
      <dc:date>2018-03-29T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Number of rows in straight table used in calculation condition</title>
      <link>https://community.qlik.com/t5/QlikView/Number-of-rows-in-straight-table-used-in-calculation-condition/m-p/33919#M5742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming the Object ID of your dynamic table is 'Custom Table':&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Create a variable to hold the row count of your table (ie. vCustomTableRows)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Create a macro to update the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sub Update_vCustomTableRows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TargetVariable = ActiveDocument.Variables("vCustomTableRows")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TableBox = ActiveDocument.GetSheetObject( "Custom Table" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomTableRows = TableBox.GetRowCount&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TargetVariable.SetContent CustomTableRows , true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) In the Calculation Condition of your custom table (General properties tab), add the criteria:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vCustomTableRows &amp;lt;= 50000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Add an action to execute the macro, to any events that would affect the number of rows in your table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a) Selection of dimensions in the dynamic table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) Data filters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c) ???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:29:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Number-of-rows-in-straight-table-used-in-calculation-condition/m-p/33919#M5742</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-02T17:29:10Z</dc:date>
    </item>
  </channel>
</rss>

