<?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: How to use a Variable in load editor to create a new variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27684#M1908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strangely if i let&amp;nbsp; the&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;exp_CurrFiscal variable like this &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;let exp_CurrFiscal = if($(vMonth_Current)&amp;gt;=1 and $(vMonth_Current)&amp;lt;4,$(vYear_Current),$(vYear_Previous));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then i reuse it s value afterwards into the next variable like this:&lt;/P&gt;&lt;P&gt;let exp_BpSales&amp;nbsp; = 'sum({&amp;lt;FiscalYear={"'&amp;amp; $(exp_CurrFiscal)&amp;amp;'"}&amp;gt;} BPSales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can make it work, but if i let &lt;SPAN style="font-size: 13.3333px;"&gt;exp_CurrFiscal by getting the current fiscal year out from a user defined function in sql server, i cannot make it work..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;here's the sql statement and variable function script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'kmit-srv2';&lt;/P&gt;&lt;P&gt;load*;&lt;/P&gt;&lt;P&gt;SQL(select cast(left(as400.[dbo].[CurrentFinancialyear](),4 )as int)&lt;STRONG&gt;CurrFiscalYear&lt;/STRONG&gt; );&lt;/P&gt;&lt;P&gt;let exp_CurrFiscal&amp;nbsp; = '&lt;STRONG&gt;CurrFiscalYear&lt;/STRONG&gt;'; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Mar 2018 09:14:11 GMT</pubDate>
    <dc:creator>marcoserilio</dc:creator>
    <dc:date>2018-03-15T09:14:11Z</dc:date>
    <item>
      <title>How to use a Variable in load editor to create a new variable</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27683#M1907</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;I'm struggling trying to make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got this variable which define Current fiscal year into a load editor script:&lt;/P&gt;&lt;P&gt;load*;&lt;/P&gt;&lt;P&gt;SQL(select left(as400.[dbo].[CurrentFinancialyear](),4)CurrFiscalYear );&lt;/P&gt;&lt;P&gt;Let &lt;SPAN style="color: #ff0000;"&gt;exp&lt;STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;_C&lt;/SPAN&gt;urrFiscal &lt;/STRONG&gt;&lt;/SPAN&gt; = 'CurrFiscalYear';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what I wanna do is to reuse &lt;SPAN style="color: #ff0000; font-size: 13.3333px;"&gt;exp&lt;/SPAN&gt;&lt;STRONG style="color: #ff0000; font-size: 13.3333px;"&gt;_CurrFiscal value&amp;nbsp; &lt;/STRONG&gt;to define a further variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let exp_ActSales='sum({&amp;lt;FiscalYear={"2017"}&amp;gt;} WholesaleQuantity)';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to replace the "2017" filter value with &lt;SPAN style="color: #ff0000; font-size: 13.3333px;"&gt;exp&lt;/SPAN&gt;&lt;STRONG style="color: #ff0000; font-size: 13.3333px;"&gt;&lt;SPAN style="color: #ff0000;"&gt;_C&lt;/SPAN&gt;urrFiscal variable, &lt;/STRONG&gt;to make the &lt;SPAN style="font-size: 13.3333px;"&gt;exp_ActSales&lt;/SPAN&gt; variable dynamically build up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;let exp_ActSales='sum({&amp;lt;FiscalYear={$(&lt;SPAN style="font-size: 13.3333px;"&gt;exp_ActSales&lt;/SPAN&gt;)}&amp;gt;} WholesaleQuantity)';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;It didn't work obviously, I wouldn't be here writing differently.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Anyone who can help me out?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2018 15:49:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27683#M1907</guid>
      <dc:creator>marcoserilio</dc:creator>
      <dc:date>2018-03-14T15:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a Variable in load editor to create a new variable</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27684#M1908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strangely if i let&amp;nbsp; the&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;exp_CurrFiscal variable like this &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;let exp_CurrFiscal = if($(vMonth_Current)&amp;gt;=1 and $(vMonth_Current)&amp;lt;4,$(vYear_Current),$(vYear_Previous));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then i reuse it s value afterwards into the next variable like this:&lt;/P&gt;&lt;P&gt;let exp_BpSales&amp;nbsp; = 'sum({&amp;lt;FiscalYear={"'&amp;amp; $(exp_CurrFiscal)&amp;amp;'"}&amp;gt;} BPSales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can make it work, but if i let &lt;SPAN style="font-size: 13.3333px;"&gt;exp_CurrFiscal by getting the current fiscal year out from a user defined function in sql server, i cannot make it work..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;here's the sql statement and variable function script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'kmit-srv2';&lt;/P&gt;&lt;P&gt;load*;&lt;/P&gt;&lt;P&gt;SQL(select cast(left(as400.[dbo].[CurrentFinancialyear](),4 )as int)&lt;STRONG&gt;CurrFiscalYear&lt;/STRONG&gt; );&lt;/P&gt;&lt;P&gt;let exp_CurrFiscal&amp;nbsp; = '&lt;STRONG&gt;CurrFiscalYear&lt;/STRONG&gt;'; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2018 09:14:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27684#M1908</guid>
      <dc:creator>marcoserilio</dc:creator>
      <dc:date>2018-03-15T09:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a Variable in load editor to create a new variable</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27685#M1909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well my feeling it's there's no way to make qlik reuse during loading action a variable previously set via a sql statement.&lt;/P&gt;&lt;P&gt;I made some extra testing, as I'm sure that the variable is correctly build up with the sql statement I've been using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact&amp;nbsp; the &lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;exp&lt;/SPAN&gt;&lt;STRONG style="color: #ff0000; font-family: inherit; font-size: 12px; font-style: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;_C&lt;/SPAN&gt;urrFiscal variable :&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;load*;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;SQL(select left(as400.[dbo].[CurrentFinancialyear](),4)CurrFiscalYear );&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Let &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;exp&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;_C&lt;/SPAN&gt;urrFiscal &lt;/STRONG&gt;&lt;/SPAN&gt;= 'CurrFiscalYear';&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;It's correctly build up when I put it on a report, but it's not during loading script action, it's as it was null&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Most likely qlik cannot validate a variable set via a sql statement.&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I'm assuming that unless qlik&amp;nbsp; an exception is thrown&amp;nbsp; back from sql server, the variable is considered as correct, but that the value it's only set at the very end of the loading process to be used on the reporting stage.&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Can anyone confirm my understanding or if I'm wrong tell me how to make qlik validate and then reuse during a further script action the &lt;SPAN style="font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;exp&lt;/SPAN&gt;&lt;STRONG style="color: #ff0000; font-family: inherit; font-size: 12px; font-style: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;_C&lt;/SPAN&gt;urrFiscal variable ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/196554_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/196555_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/196559_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/196560_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 08:06:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-a-Variable-in-load-editor-to-create-a-new-variable/m-p/27685#M1909</guid>
      <dc:creator>marcoserilio</dc:creator>
      <dc:date>2018-03-16T08:06:39Z</dc:date>
    </item>
  </channel>
</rss>

