<?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 Why do variables lose their contents? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372916#M138669</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Magus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have mentioned the variables are created in &lt;/P&gt;&lt;P&gt;SETTINGS | DOCUMENT PROPERTIES | Variables Tab &lt;/P&gt;&lt;P&gt;Then I enter the formula in the value field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I select a row in a table and have a button which executes a macro which retrieves the value of the variable and then uses it to fill in the email address in an email in Outlook. I do it this way as I couldn't find a way to directly enter QlikView fields into macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2012 14:54:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-05-29T14:54:47Z</dc:date>
    <item>
      <title>Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372914#M138667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Does anyone know why variables lose their contents? e.g. I have a variable which has a formula &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=' Email : ' &amp;amp; EmailAddress &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a macro (launched via a button) which uses the content of this variable. For some reason the contents of the variable gets cleared and the formula is lost.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 14:33:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372914#M138667</guid>
      <dc:creator />
      <dc:date>2012-05-29T14:33:08Z</dc:date>
    </item>
    <item>
      <title>Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372915#M138668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi MarkBoomer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how you declared your variable, and the variable behaves differently depending on how it was declared.&lt;/P&gt;&lt;P&gt;LET variable1 = something;&lt;/P&gt;&lt;P&gt;vs.&lt;/P&gt;&lt;P&gt;SET variable2 = something else;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET variables are first evaluated, then the evaluated expression is stored into the variable.&lt;/P&gt;&lt;P&gt;SET variables: The expression itself is stored in the variable and behaves like a dynamic variable which gets updated when for example your selections change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try and always declare variables in the script, not in the GUI variable overview.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/21613"&gt;Magnus Åvitsland&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.framsteg.com" target="_blank"&gt;Framsteg Business Intelligence Corp.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 14:37:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372915#M138668</guid>
      <dc:creator>magavi_framsteg</dc:creator>
      <dc:date>2012-05-29T14:37:39Z</dc:date>
    </item>
    <item>
      <title>Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372916#M138669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Magus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should have mentioned the variables are created in &lt;/P&gt;&lt;P&gt;SETTINGS | DOCUMENT PROPERTIES | Variables Tab &lt;/P&gt;&lt;P&gt;Then I enter the formula in the value field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I select a row in a table and have a button which executes a macro which retrieves the value of the variable and then uses it to fill in the email address in an email in Outlook. I do it this way as I couldn't find a way to directly enter QlikView fields into macros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 14:54:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372916#M138669</guid>
      <dc:creator />
      <dc:date>2012-05-29T14:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372917#M138670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again MarkBoomer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some macro code examples on how to get/set fields/variable content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;GetVariableValue:&lt;/P&gt;&lt;P&gt;SET vMacroVar = ActiveDocument.Variables("NameOfDocumentVariable")&lt;/P&gt;&lt;P&gt;vMacroVar.GetContent.String&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SetVariableValue:&lt;/P&gt;&lt;P&gt;SET vMacroVar = ActiveDocument.Variables("NameOfDocumentVariable")&lt;/P&gt;&lt;P&gt;vMacroVar.SetContent "ValueToSet", True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GetFieldValue:&lt;/P&gt;&lt;P&gt;ActiveDocument.Fields("FieldName").GetSelectedValues.Item(0).Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SetFieldValue:&lt;/P&gt;&lt;P&gt;ActiveDocument.Fields("FieldName").select "ValueToSet"&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/21613"&gt;Magnus Åvitsland&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.framsteg.com" target="_blank"&gt;Framsteg Business Intelligence Corp.&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 07:24:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372917#M138670</guid>
      <dc:creator>magavi_framsteg</dc:creator>
      <dc:date>2012-05-30T07:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372918#M138671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Magnus &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats similar to what I'm using in the macro to get the value of the variable. The problem is that the variable is set already in the Document settings and the macro retrieves the value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that by the time the macro retrieves the variable the contents (i.e. the formula which creates the value) has been cleared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 14:27:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372918#M138671</guid>
      <dc:creator />
      <dc:date>2012-05-30T14:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why do variables lose their contents?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372919#M138672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I eventually did was to delete the bookmarks I was using. &lt;/P&gt;&lt;P&gt;Then fill in the formula's I needed in the variables.&lt;/P&gt;&lt;P&gt;Then create the bookmarks again&lt;/P&gt;&lt;P&gt;Activate the new bookmarks via the buttons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This for the time being seems to have stopped the formulas from being deleted from the variables&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 14:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-do-variables-lose-their-contents/m-p/372919#M138672</guid>
      <dc:creator />
      <dc:date>2012-06-28T14:08:11Z</dc:date>
    </item>
  </channel>
</rss>

