<?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: Set Variable values based on an if then else statement in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818490#M9210</link>
    <description>&lt;P&gt;Perfect, thank you! That did the trick!&lt;/P&gt;&lt;P&gt;I was going out of my mind&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jun 2021 09:03:37 GMT</pubDate>
    <dc:creator>madsgrathe</dc:creator>
    <dc:date>2021-06-29T09:03:37Z</dc:date>
    <item>
      <title>Set Variable values based on an if then else statement</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818472#M9207</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm trying to use the name of an app to determine where my data should be loaded from. The idea is that if an app has a ' Dev' at the end of it, i.e. 'Dashboard Dev', then data should be loaded from the development environment, else it should load from the production environment.&lt;/P&gt;&lt;P&gt;The 'Dashboard Dev' app will be published to a Shared Space, whereas the 'Dashboard' app will be published to the Managed Space.&lt;/P&gt;&lt;P&gt;So basically I'd like to use the Shared Space as the development environment and the Managed Space as the production environment.&lt;/P&gt;&lt;P&gt;My idea was to have a small script section in the beginning of the load script that reads something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;LET vDocumentTitle = DocumentTitle();

IF '$(vDocumentTitle)' = 'Dashboard Dev'
THEN
SET vLibConnection = 'Shared Space Name:Dashboard_Azure_Dev';
SET vDatabaseName = 'Database_Dev';
ELSE
SET vLibConnection = 'Shared Space Name:Dashboard_Azure_Prod';
SET vDatabaseName = 'Database_Prod';
END IF&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;This would then let me use variables in the following load script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;LIB CONNECT TO "$(vLibConnection)";

[Dim_Customer]:
LOAD *;
SELECT *
FROM "$(vDatabaseName)".qlik."Dim_Customer";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The latter works fine. It's the first IF...THEN...ELSE statement that fails.&lt;/P&gt;&lt;P&gt;It fails around the THEN statement. Any ideas as to what I'm doing wrong?&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-06-29_10h06_58.png" style="width: 605px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/57691i97BF4BF61C1D4C44/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-06-29_10h06_58.png" alt="2021-06-29_10h06_58.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 08:09:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818472#M9207</guid>
      <dc:creator>madsgrathe</dc:creator>
      <dc:date>2021-06-29T08:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set Variable values based on an if then else statement</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818482#M9209</link>
      <description>&lt;P&gt;Bring the 'THEN' in the same line as of 'IF' - it should work fine then.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tresesco_0-1624956584513.png" style="width: 550px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/57694iBF9D38FF2DE08082/image-dimensions/550x66?v=v2" width="550" height="66" role="button" title="tresesco_0-1624956584513.png" alt="tresesco_0-1624956584513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 08:50:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818482#M9209</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2021-06-29T08:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set Variable values based on an if then else statement</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818490#M9210</link>
      <description>&lt;P&gt;Perfect, thank you! That did the trick!&lt;/P&gt;&lt;P&gt;I was going out of my mind&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 09:03:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Set-Variable-values-based-on-an-if-then-else-statement/m-p/1818490#M9210</guid>
      <dc:creator>madsgrathe</dc:creator>
      <dc:date>2021-06-29T09:03:37Z</dc:date>
    </item>
  </channel>
</rss>

