<?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: Script variable value persists *after deletion* in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672654#M50924</link>
    <description>&lt;P&gt;sorry - you're missing the point. What I'm saying is that the variable seems to disappear, but the during the execution of the script any reference to it (even though it is no longer there) will return the value it had before you deleted it.&lt;/P&gt;&lt;P&gt;This can lead to some very odd behaviour in scripts!!!&lt;/P&gt;&lt;P&gt;I've just simplified it down as far as possible to highlight what appears to be a pretty serious bug!&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;P&gt;Your comments have alerted me to something though - the variable still seems to exist in the App, even though it is no longer in the script. As&amp;nbsp; you can see in the screenshot below, v2 is no longer a script variable, but it is still there&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":neutral_face:"&gt;😐&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2020-02-05 161449.jpg" style="width: 664px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/28010i1998748950973AC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2020-02-05 161449.jpg" alt="Annotation 2020-02-05 161449.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2020 18:18:22 GMT</pubDate>
    <dc:creator>davequinn</dc:creator>
    <dc:date>2020-02-05T18:18:22Z</dc:date>
    <item>
      <title>Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672602#M50915</link>
      <description>&lt;DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&lt;SPAN&gt;Can anyone explain this? It feels like a bug to me, but i'm always ready to be corrected...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&lt;SPAN&gt;In Qlik Sense scripts it seems that once you have instantiated a variable, its value will persist in subsequent reloads&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&lt;SPAN&gt;&lt;STRONG&gt;even if you delete the variable&lt;/STRONG&gt;. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&lt;EM&gt;Simple example (create 2 variables, concat to a 3rd). Then delete one of the variables, but it is interpreted as if it was still there; the result is the same:&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="simple script" style="width: 262px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/27998iB0095FBE31CCCB89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annotation 2020-02-05 161446.jpg" alt="simple script" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;simple script&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result after load" style="width: 187px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/27997iB185B48DC2A6F007/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annotation 2020-02-05 161447.jpg" alt="result after load" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;result after load&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="delete v2 ... makes no difference" style="width: 249px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/27999iE6B17E7D3B22D7ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annotation 2020-02-05 161448.jpg" alt="delete v2 ... makes no difference" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;delete v2 ... makes no difference&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Furthermore it will persist in any &lt;EM&gt;&lt;STRONG&gt;copies&lt;/STRONG&gt; &lt;/EM&gt;of the App you make,&lt;/SPAN&gt;&lt;SPAN&gt; even after you have made the deletion. ie Duplicating the App above, after deleting v2 will produce the same result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Currently testing on June 2019 release of qliksenseserver : 13.32.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:10:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672602#M50915</guid>
      <dc:creator>davequinn</dc:creator>
      <dc:date>2024-11-16T19:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672631#M50922</link>
      <description>&lt;P&gt;To clear variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SET v1=;&lt;/P&gt;&lt;P&gt;SET v2=;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 16:47:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672631#M50922</guid>
      <dc:creator>jpenuliar</dc:creator>
      <dc:date>2020-02-05T16:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672643#M50923</link>
      <description>&lt;P&gt;If you create a variable in the script&lt;/P&gt;&lt;P&gt;Set var1 = 'Abc';&lt;/P&gt;&lt;P&gt;it will be available in the variable overview in the design edit mode.&lt;/P&gt;&lt;P&gt;If you later remove the row&lt;/P&gt;&lt;P&gt;//Set var1 = 'Abc';&lt;/P&gt;&lt;P&gt;The variable will still be available with the value 'ABC', but you can manually edit it in the variable overview in the design mode.&lt;/P&gt;&lt;P&gt;If you in the script instead empty the content of the variable, the variable will be available in the variable overview, but with no value.&lt;/P&gt;&lt;P&gt;Set var1 = ;&lt;/P&gt;&lt;P&gt;To keep an variable from appearing in the variable overview at all you need to always empty the content of the variable&amp;nbsp;&lt;STRONG&gt;before&lt;/STRONG&gt; the script ends. The var2 below will not end up in the variable overview and not be available during the next reload.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set var2 = 'Xyz.qvd';&lt;/P&gt;&lt;P&gt;Load * from&amp;nbsp; '$(var2)' (qvd);&lt;/P&gt;&lt;P&gt;Set var2 = ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 17:43:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672643#M50923</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-02-05T17:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672654#M50924</link>
      <description>&lt;P&gt;sorry - you're missing the point. What I'm saying is that the variable seems to disappear, but the during the execution of the script any reference to it (even though it is no longer there) will return the value it had before you deleted it.&lt;/P&gt;&lt;P&gt;This can lead to some very odd behaviour in scripts!!!&lt;/P&gt;&lt;P&gt;I've just simplified it down as far as possible to highlight what appears to be a pretty serious bug!&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;P&gt;Your comments have alerted me to something though - the variable still seems to exist in the App, even though it is no longer in the script. As&amp;nbsp; you can see in the screenshot below, v2 is no longer a script variable, but it is still there&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":neutral_face:"&gt;😐&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2020-02-05 161449.jpg" style="width: 664px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/28010i1998748950973AC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2020-02-05 161449.jpg" alt="Annotation 2020-02-05 161449.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 18:18:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672654#M50924</guid>
      <dc:creator>davequinn</dc:creator>
      <dc:date>2020-02-05T18:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672678#M50925</link>
      <description>&lt;P&gt;What do you mean when you write that "the variable seems to disappear"? What actions did you do to make it disappear?&lt;/P&gt;&lt;P&gt;PS: If the variable is available in the app then it is also available in the script. DS&lt;/P&gt;&lt;P&gt;Try this and see if you still get the var2 value in the second iteration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;set v1 = 'variable 1';
set v2 = 'variable 2';
LET v3 = v1 &amp;amp; ','&amp;amp; v2;
set v2=;

LOAD 
1 as Iteration,
'$(v3)' as V3
AutoGenerate 1;

LET v3 = v1 &amp;amp; ','&amp;amp; v2;
LOAD 
2 as Iteration,
'$(v3)' as V3
AutoGenerate 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 19:28:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672678#M50925</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-02-05T19:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672819#M50952</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Vegar,&lt;/P&gt;&lt;P&gt;As in the original post, I deleted the 2nd line - so there is no assignment of v2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I now understand the mechanism at work here better - ie that the &lt;STRONG&gt;script variable&lt;/STRONG&gt; has &lt;EM&gt;migrated&lt;/EM&gt; into the App.&lt;/P&gt;&lt;P&gt;And I can see how to work around it - you delete it from the variables panel in the App...&lt;/P&gt;&lt;P&gt;But it still feels very wrong! This automatic migration from script to app makes me very uncomfortable;&amp;nbsp;Its like the App has a sort of homeopathic memory of all variables that were ever used at some point in its past!&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can lead to some very unexpected behaviour in load scripts if you aren't aware. &lt;EM&gt;I have Apps which have been in development for years, undergoing countless revisions and often being duplicated to serve as the basis for new Apps.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I don't think this needs any further discussion, but in any other context&amp;nbsp; I would describe it as a bug&amp;nbsp; - where else would you expect to have to delete a variable not only from the code, but also the executable?&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 09:00:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672819#M50952</guid>
      <dc:creator>davequinn</dc:creator>
      <dc:date>2020-02-06T09:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script variable value persists *after deletion*</title>
      <link>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672914#M50966</link>
      <description>&lt;P&gt;I see your point, but there are also advantages from having it this way. It might help you understand the concept if you see the script and the gui as an unity and not two separate entities.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 11:57:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Script-variable-value-persists-after-deletion/m-p/1672914#M50966</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2020-02-06T11:57:23Z</dc:date>
    </item>
  </channel>
</rss>

