<?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 Switch models when condition matched in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Switch-models-when-condition-matched/m-p/2019824#M84208</link>
    <description>&lt;P&gt;Hi community,&lt;/P&gt;
&lt;P&gt;I have an app used to monitor price list over time. I want to observe both general situation as well as details by list of products. But because the data is huge, I just take needed information by uploading file included required product code. Hence, I build 2 models in my app:&lt;/P&gt;
&lt;P&gt;- Model 1: grouped information used for general visualization&lt;/P&gt;
&lt;P&gt;- Model 2: uploaded product list&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what I want to know is how to switch between 2 models with the logic: if a product list is uploaded, use model 2 to run all visualization sheets, else use model 1&lt;/P&gt;
&lt;P&gt;Is there any way to do so?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 26 Dec 2022 03:13:20 GMT</pubDate>
    <dc:creator>HanhLe</dc:creator>
    <dc:date>2022-12-26T03:13:20Z</dc:date>
    <item>
      <title>Switch models when condition matched</title>
      <link>https://community.qlik.com/t5/App-Development/Switch-models-when-condition-matched/m-p/2019824#M84208</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;
&lt;P&gt;I have an app used to monitor price list over time. I want to observe both general situation as well as details by list of products. But because the data is huge, I just take needed information by uploading file included required product code. Hence, I build 2 models in my app:&lt;/P&gt;
&lt;P&gt;- Model 1: grouped information used for general visualization&lt;/P&gt;
&lt;P&gt;- Model 2: uploaded product list&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what I want to know is how to switch between 2 models with the logic: if a product list is uploaded, use model 2 to run all visualization sheets, else use model 1&lt;/P&gt;
&lt;P&gt;Is there any way to do so?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 03:13:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Switch-models-when-condition-matched/m-p/2019824#M84208</guid>
      <dc:creator>HanhLe</dc:creator>
      <dc:date>2022-12-26T03:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Switch models when condition matched</title>
      <link>https://community.qlik.com/t5/App-Development/Switch-models-when-condition-matched/m-p/2019876#M84212</link>
      <description>&lt;P&gt;if both the models are independent and their script do not depend on each other at all, then you can write an if condition to check if product list file is uploaded at a location and run model 2 script. else run model 1 script.&lt;/P&gt;
&lt;P&gt;If the product list is uploaded in excel,&amp;nbsp; you can use similar logic as below:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;let vFilePath='lib://Product list/Prod1.xlsx';&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;for each file in filelist('$(vFilePath)')&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;FileList:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;'$(file)' as FileName,&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;filetime('$(file)') as FileTime&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;autogenerate 1&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;next&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;let vFileCount = NoofRows('FileList');&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;// if condition started&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if '$(vFileCount)' &amp;gt; 0 then&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;// Add model 2 code here&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;else&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;// Add model 1 code here&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;endif&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Aditya&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 10:14:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Switch-models-when-condition-matched/m-p/2019876#M84212</guid>
      <dc:creator>Aditya_Chitale</dc:creator>
      <dc:date>2022-12-26T10:14:05Z</dc:date>
    </item>
  </channel>
</rss>

