<?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: Why does this dollar expansion evaluate to blank? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481225#M100807</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37484"&gt;@mmarchese&lt;/a&gt;&amp;nbsp; As variable created with SET doesn't evaluate expression, one more thing you can do is create a separate variable for today and then call it in SET variable expression like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;let vToday = Today();

set vm_piecesRequiredPastDue = Sum({&amp;lt;[Req. Date]={"&amp;lt;$(vToday)"}&amp;gt;} m_piecesRequired)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2024 08:56:36 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2024-09-12T08:56:36Z</dc:date>
    <item>
      <title>Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481116#M100791</link>
      <description>&lt;P&gt;If I use this expression in a measure directly, it works fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Sum({&amp;lt;[Req. Date]={"&amp;lt;$(=Today())"}&amp;gt;} m_piecesRequired)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if I put that expression in a variable in the load script, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Set vm_piecesRequiredPastDue = Sum({&amp;lt;[Req. Date]={"&amp;lt;$(=Today())"}&amp;gt;} m_piecesRequired);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...then when I look at the variable in the app, the variable definition will have become this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Sum({&amp;lt;[Req. Date]={"&amp;lt;"}&amp;gt;} m_piecesRequired)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried many variations of that Set statement, but the "today" part always ends up blank.&amp;nbsp; What is going on here and what can I do differently?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 17:11:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481116#M100791</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2024-09-12T17:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481124#M100793</link>
      <description>&lt;P&gt;The script attempts to interpret the value in the $() (DSE), but script does not evaluate expressions in DSE, hence the null.&amp;nbsp; in order to properly retain the entire expression you need to break up the "$(" into two strings and reassemble like this:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;LET vm_piecesRequiredPastDue = 'Sum({&amp;lt;[Req. Date]={"&amp;lt;$' &amp;amp; '(=Today())"}&amp;gt;} m_piecesRequired)';&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 23:32:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481124#M100793</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-09-11T23:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481147#M100796</link>
      <description>&lt;P&gt;Is it important to get the dollar expansion into the variable? Or are you moving it to the script in order to lock the today() value? If so then you could skip the dollarexpansion and replace it with the value of today.&lt;/P&gt;
&lt;P&gt;LET vm_piecesRequiredPastDue = 'Sum({&amp;lt;[Req. Date]={"&amp;lt;' &amp;amp; Today() &amp;amp; '"}&amp;gt;} m_piecesRequired)';&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 05:01:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481147#M100796</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2024-09-12T05:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481225#M100807</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37484"&gt;@mmarchese&lt;/a&gt;&amp;nbsp; As variable created with SET doesn't evaluate expression, one more thing you can do is create a separate variable for today and then call it in SET variable expression like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;let vToday = Today();

set vm_piecesRequiredPastDue = Sum({&amp;lt;[Req. Date]={"&amp;lt;$(vToday)"}&amp;gt;} m_piecesRequired)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 08:56:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481225#M100807</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-12T08:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481359#M100822</link>
      <description>&lt;P&gt;Rob,&lt;/P&gt;
&lt;P&gt;Thanks for this.&lt;/P&gt;
&lt;P&gt;1) Can you elaborate on how the script does DSE but does not "evaluate expressions"?&amp;nbsp; Does that mean every time it sees "$(=...)" it will replace "..." with nothing?&amp;nbsp; (That seems like a really poor design decision on Qlik's part, unless I'm misunderstanding.&amp;nbsp; Why not either do the real evaluation or leave the text alone?&amp;nbsp; Who could ever benefit from the text just being deleted?)&lt;/P&gt;
&lt;P&gt;2) It seems that this technique won't solve my issue completely as is because this variable is just an intermediate one, so the "today" expression just gets deleted in a later step.&amp;nbsp; Is there a way to get the expression to survive multiple levels of DSE?&amp;nbsp; Here's what I mean:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Let vm_piecesRequiredPastDue = 'Sum({&amp;lt;[Req. Date]={"&amp;lt;$' &amp;amp; '(=Today())"}&amp;gt;} m_piecesRequired)';

Set vm_piecesShortfallPastDue = ($(vm_piecesRequiredPastDue) - $(vm_piecesStock));

// Result: 
vm_piecesRequiredPastDue: Sum({&amp;lt;[Req. Date]={"&amp;lt;$(=Today())"}&amp;gt;} m_piecesRequired);  // good
vm_piecesShortfallPastDue: (Sum({&amp;lt;[Req. Date]={"&amp;lt;"}&amp;gt;} m_piecesRequired) - Sum(m_piecesStock)); // today is gone&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I could sidestep this issue by putting the entire definition in each variable instead of composing variables from other variables, but I'd rather not since it'd be terrible coding practice.&amp;nbsp; It wouldn't be that bad in this particular case, but some of these formulas end up being half a page of text by the final level.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:55:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481359#M100822</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2024-09-12T16:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481360#M100823</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; To answer your question, I am just defining it in the script because I like having all the code in one place instead of scattered among the GUI.&amp;nbsp; But since this particular app reloads frequently, I could get away with setting today's date at load time as you did instead of "live" on the front end.&amp;nbsp; I will likely go with this idea (or Kushal's equivalent) since it works well with multiple levels of replacement, allowing me to compose one variable from others without a headache.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:50:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481360#M100823</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2024-09-12T16:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this dollar expansion evaluate to blank?</title>
      <link>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481361#M100824</link>
      <description>&lt;P&gt;Thanks, I like this.&amp;nbsp; I had tried this method myself but mistakenly used "set" instead of "let" when defining vToday, so it didn't work.&amp;nbsp; Now I see it's actually viable.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 16:52:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Why-does-this-dollar-expansion-evaluate-to-blank/m-p/2481361#M100824</guid>
      <dc:creator>mmarchese</dc:creator>
      <dc:date>2024-09-12T16:52:55Z</dc:date>
    </item>
  </channel>
</rss>

