<?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 Re: Using Variables in Expressions in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770111#M10839</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post the script command that sets the variable ?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SET ANALYSIS , a modifier always references an actual field in the data model like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;DurationField={"&amp;gt;30"}&amp;gt;}&amp;nbsp;&amp;nbsp; ReportNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if variable = 30 you can pull that in like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;DurationField={"&amp;gt;$(NCDuration)"}&amp;gt;}&amp;nbsp;&amp;nbsp; ReportNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If NCDuration calculates something like Sum(DurationField) then you can reference another field like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count {$&amp;lt;County={"$(NCDuration)&amp;gt;30"}&amp;gt;}&amp;nbsp; ReportNumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...which would bring back a selection of countries where sum(Duration) by country was &amp;gt; 30 ... and from that selection get you a count of the ReportNumbers &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps:&amp;nbsp;&amp;nbsp; you may want to do a count(distinct&amp;nbsp;&amp;nbsp; to only get unique reportnumbers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways post your script command and it may give clues &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Dec 2014 01:07:05 GMT</pubDate>
    <dc:creator>JonnyPoole</dc:creator>
    <dc:date>2014-12-04T01:07:05Z</dc:date>
    <item>
      <title>Using Variables in Expressions</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770110#M10838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everybody;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as i'm new to QS i'm trying to figure our how variables are used in QS Expressions;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have successfully created a Variable in the script called "NCDuration"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i tried to create a measure based on this variable in the following manner without success:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({$&amp;lt;[NCDuration&amp;gt;30]&amp;gt;}&amp;nbsp; ReportNumber)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea was to count all the existing records &amp;gt;30 days&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will highly appreciate any help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:52:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770110#M10838</guid>
      <dc:creator />
      <dc:date>2014-12-03T22:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Variables in Expressions</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770111#M10839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post the script command that sets the variable ?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SET ANALYSIS , a modifier always references an actual field in the data model like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;DurationField={"&amp;gt;30"}&amp;gt;}&amp;nbsp;&amp;nbsp; ReportNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if variable = 30 you can pull that in like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;DurationField={"&amp;gt;$(NCDuration)"}&amp;gt;}&amp;nbsp;&amp;nbsp; ReportNumber)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If NCDuration calculates something like Sum(DurationField) then you can reference another field like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count {$&amp;lt;County={"$(NCDuration)&amp;gt;30"}&amp;gt;}&amp;nbsp; ReportNumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...which would bring back a selection of countries where sum(Duration) by country was &amp;gt; 30 ... and from that selection get you a count of the ReportNumbers &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps:&amp;nbsp;&amp;nbsp; you may want to do a count(distinct&amp;nbsp;&amp;nbsp; to only get unique reportnumbers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways post your script command and it may give clues &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 01:07:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770111#M10839</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-12-04T01:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using Variables in Expressions</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770112#M10840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan and thank you for your prompt answer;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have added the following line after the LOAD script&lt;/P&gt;&lt;P&gt;CloaseDate and CreateDate are dates represented as numbers in my file (extracted from a system we have)&lt;/P&gt;&lt;P&gt;i have checked that the NCDuration set the desired output and it works fine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET NCDuration=Date(CloseDate,'DD/MM/YY')-Date(CreateDate,'DD/MM/YY')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i will look more closely at your answer to see if i've figure it out &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 07:29:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770112#M10840</guid>
      <dc:creator />
      <dc:date>2014-12-04T07:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using Variables in Expressions</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770113#M10841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took the liberty of making this work internally.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The working syntax in the measure is as follows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count(&amp;nbsp; {$&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ReportNumber&lt;/SPAN&gt;={"=($(NCDuration)) &amp;lt; 30"}&amp;gt;}&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ReportNumber&lt;/SPAN&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 15:58:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Variables-in-Expressions/m-p/770113#M10841</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-12-04T15:58:27Z</dc:date>
    </item>
  </channel>
</rss>

