<?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 Parameter with function (YearStart) inside a variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Parameter-with-function-YearStart-inside-a-variable/m-p/1665071#M50034</link>
    <description>&lt;P&gt;I want to use a function&amp;nbsp;&lt;SPAN&gt;fYTD, that I succeeded to make with the following code :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Set vMaxDate='30/12/2019';&lt;BR /&gt;Let vDateDeb=YearStart('$(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;)');&lt;BR /&gt;Set fYTD='YTD' &amp;amp; ' ' &amp;amp; (count({$&amp;lt;Date= {"&amp;gt;=$(&lt;SPAN&gt;vDateDeb&lt;/SPAN&gt;)&amp;lt;=$(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;)"}, $1&amp;gt;} $2));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now instead of having the&amp;nbsp;&lt;SPAN&gt;DateDeb&lt;/SPAN&gt; variable, I would like to have a third parameter inside&amp;nbsp;&lt;SPAN&gt;fYTD&lt;/SPAN&gt; (&lt;SPAN&gt;YearStart('$(&lt;/SPAN&gt;&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;&lt;SPAN&gt;)');&lt;/SPAN&gt;) ?&lt;/P&gt;&lt;P&gt;&lt;U&gt;Something that I would use like that:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;$(fYTD($(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;),[Contrat_type]={'Coll'},NUM_SO ))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried many things but it never work... Any idea ?&lt;/P&gt;&lt;P&gt;I don't get any date in the final result.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:36:18 GMT</pubDate>
    <dc:creator>bertrand01</dc:creator>
    <dc:date>2024-11-16T03:36:18Z</dc:date>
    <item>
      <title>Parameter with function (YearStart) inside a variable</title>
      <link>https://community.qlik.com/t5/App-Development/Parameter-with-function-YearStart-inside-a-variable/m-p/1665071#M50034</link>
      <description>&lt;P&gt;I want to use a function&amp;nbsp;&lt;SPAN&gt;fYTD, that I succeeded to make with the following code :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Set vMaxDate='30/12/2019';&lt;BR /&gt;Let vDateDeb=YearStart('$(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;)');&lt;BR /&gt;Set fYTD='YTD' &amp;amp; ' ' &amp;amp; (count({$&amp;lt;Date= {"&amp;gt;=$(&lt;SPAN&gt;vDateDeb&lt;/SPAN&gt;)&amp;lt;=$(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;)"}, $1&amp;gt;} $2));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now instead of having the&amp;nbsp;&lt;SPAN&gt;DateDeb&lt;/SPAN&gt; variable, I would like to have a third parameter inside&amp;nbsp;&lt;SPAN&gt;fYTD&lt;/SPAN&gt; (&lt;SPAN&gt;YearStart('$(&lt;/SPAN&gt;&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;&lt;SPAN&gt;)');&lt;/SPAN&gt;) ?&lt;/P&gt;&lt;P&gt;&lt;U&gt;Something that I would use like that:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;$(fYTD($(&lt;SPAN&gt;vMaxDate&lt;/SPAN&gt;),[Contrat_type]={'Coll'},NUM_SO ))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried many things but it never work... Any idea ?&lt;/P&gt;&lt;P&gt;I don't get any date in the final result.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:36:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Parameter-with-function-YearStart-inside-a-variable/m-p/1665071#M50034</guid>
      <dc:creator>bertrand01</dc:creator>
      <dc:date>2024-11-16T03:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter with function (YearStart) inside a variable</title>
      <link>https://community.qlik.com/t5/App-Development/Parameter-with-function-YearStart-inside-a-variable/m-p/1665471#M50092</link>
      <description>&lt;P&gt;Your dates seems to be quite static - therefore why do you want to add them within the call? I think I would rather do it in this way:&lt;/P&gt;&lt;P&gt;Let vMaxDate = num(makedate(2019, 12, 30));&lt;BR /&gt;Set fYTD = 'YTD ' &amp;amp; (count({$&amp;lt;Date&lt;STRONG&gt;Num&lt;/STRONG&gt; = {"&amp;gt;=floor(yearstart($(vMaxDate)))&amp;lt;=$(vMaxDate)"}, $1&amp;gt;} $2));&lt;/P&gt;&lt;P&gt;and then calling it with: $(fYTD([Contrat_type]={'Coll'},NUM_SO ))&lt;/P&gt;&lt;P&gt;The use of num(), floor() and Date&lt;STRONG&gt;Num&lt;/STRONG&gt; isn't accidentally else it avoids the quite common issues that the variables have the wrong format, are not interpreted as dates or are interpreted as divisions like 30/12/2019 or aren't dates else timestamps like yearstart() would return. Of course everything of it could be done additionally within the variables/calls - but why doing simple things in a complicated way?&lt;/P&gt;&lt;P&gt;Even more likely as the above would be that I would flag YTD and similar things within the master-calendar and then the variable and call might look like:&lt;/P&gt;&lt;P&gt;Set fYTD = '$1 ' &amp;amp; (count({$&amp;lt;[$1] = {1}, $2&amp;gt;} $3));&lt;/P&gt;&lt;P&gt;$(fYTD(YTD,[Contrat_type]={'Coll'},NUM_SO ))&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 15:42:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Parameter-with-function-YearStart-inside-a-variable/m-p/1665471#M50092</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-01-14T15:42:39Z</dc:date>
    </item>
  </channel>
</rss>

