<?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 Reading a List from Excel and Setting as a Variable Value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126200#M91649</link>
    <description>&lt;P&gt;I am trying to read a list of values from an excel sheet where the name of the variable is in column A and the value of the variable is column B&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Name&lt;/TD&gt;
&lt;TD width="50%"&gt;Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ListA&lt;/TD&gt;
&lt;TD width="50%"&gt;['abc','def','ghi','jkl']&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ListB&lt;/TD&gt;
&lt;TD width="50%"&gt;['mno','pqr','stu']&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am loading the data in from the file and then setting up my variables as such&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LET vNROWS = NoOfRows('Variable');

FOR i=0 to (vNROWS-1)
LET vVariable_Name = Peek('Variable_Name', i, 'Variable');
[$(vVariable_Name)] = Peek('Variable_Value', i, 'Variable');
next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when it finishes looping through I expect to have two list variables: $(ListA) and $(ListB) with the values&lt;/P&gt;
&lt;P&gt;$(ListA) =&amp;nbsp;['abc','def','ghi','jkl']&lt;/P&gt;
&lt;P&gt;$(ListB) =&amp;nbsp;['mno','pqr','stu']&lt;/P&gt;
&lt;P&gt;I then want to use the value in an if statement of another data load&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD
 Letters,
 if(match(Letters, $(ListA)), 'List A', 
  if(match(Letter, $(ListB)), 'List B', 'No List')) as List_Title
FROM other_file.QVD (qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I always get an error on one of the commas or apostrophes, etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to read a string that is a list and convert it to a list value so that it can be used later on in my code?&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2023 18:43:50 GMT</pubDate>
    <dc:creator>hannahnoelle797</dc:creator>
    <dc:date>2023-10-06T18:43:50Z</dc:date>
    <item>
      <title>Reading a List from Excel and Setting as a Variable Value</title>
      <link>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126200#M91649</link>
      <description>&lt;P&gt;I am trying to read a list of values from an excel sheet where the name of the variable is in column A and the value of the variable is column B&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Name&lt;/TD&gt;
&lt;TD width="50%"&gt;Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ListA&lt;/TD&gt;
&lt;TD width="50%"&gt;['abc','def','ghi','jkl']&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ListB&lt;/TD&gt;
&lt;TD width="50%"&gt;['mno','pqr','stu']&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am loading the data in from the file and then setting up my variables as such&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LET vNROWS = NoOfRows('Variable');

FOR i=0 to (vNROWS-1)
LET vVariable_Name = Peek('Variable_Name', i, 'Variable');
[$(vVariable_Name)] = Peek('Variable_Value', i, 'Variable');
next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when it finishes looping through I expect to have two list variables: $(ListA) and $(ListB) with the values&lt;/P&gt;
&lt;P&gt;$(ListA) =&amp;nbsp;['abc','def','ghi','jkl']&lt;/P&gt;
&lt;P&gt;$(ListB) =&amp;nbsp;['mno','pqr','stu']&lt;/P&gt;
&lt;P&gt;I then want to use the value in an if statement of another data load&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD
 Letters,
 if(match(Letters, $(ListA)), 'List A', 
  if(match(Letter, $(ListB)), 'List B', 'No List')) as List_Title
FROM other_file.QVD (qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I always get an error on one of the commas or apostrophes, etc.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to read a string that is a list and convert it to a list value so that it can be used later on in my code?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 18:43:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126200#M91649</guid>
      <dc:creator>hannahnoelle797</dc:creator>
      <dc:date>2023-10-06T18:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a List from Excel and Setting as a Variable Value</title>
      <link>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126205#M91650</link>
      <description>&lt;P&gt;This seemed to work for me:&lt;/P&gt;
&lt;DIV&gt;Variable:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Name as Variable_Name,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Value2 as Variable_Value&lt;/DIV&gt;
&lt;DIV&gt;FROM [lib://MyFolder/ScriptTesting.xlsx]&lt;/DIV&gt;
&lt;DIV&gt;(ooxml, embedded labels, table is Sheet1);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;LET vNROWS = NoOfRows('Variable');&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;FOR i=0 to (vNROWS-1)&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; LET vVariable_Name = Peek('Variable_Name', i, 'Variable');&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; v$(vVariable_Name) = Peek('Variable_Value', i, 'Variable');&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;next i;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;table:&lt;/DIV&gt;
&lt;DIV&gt;load&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; Letters,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; if(&lt;STRONG&gt;wildmatch('$(vListA)', '*|'&amp;amp;Letters&amp;amp;'|*')&lt;/STRONG&gt;, 'List A',&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; if(&lt;STRONG&gt;wildmatch('$(vListB)', '*|'&amp;amp;Letters&amp;amp;'|*')&lt;/STRONG&gt;, 'List B', 'No List')) as List_Title&lt;/DIV&gt;
&lt;DIV&gt;inline [&lt;/DIV&gt;
&lt;DIV&gt;Letters&lt;/DIV&gt;
&lt;DIV&gt;abc&lt;/DIV&gt;
&lt;DIV&gt;def&lt;/DIV&gt;
&lt;DIV&gt;ghi&lt;/DIV&gt;
&lt;DIV&gt;kjl&lt;/DIV&gt;
&lt;DIV&gt;jkl&lt;/DIV&gt;
&lt;DIV&gt;mno&lt;/DIV&gt;
&lt;DIV&gt;pqr&lt;/DIV&gt;
&lt;DIV&gt;stu&lt;/DIV&gt;
&lt;DIV&gt;abd&lt;/DIV&gt;
&lt;DIV&gt;ab&lt;/DIV&gt;
&lt;DIV&gt;stuu&lt;/DIV&gt;
&lt;DIV&gt;]&lt;/DIV&gt;
&lt;DIV&gt;;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Notably, I changed the list variable to use Value2 instead of Value. Value 2 used the pipe character, |, as a separator and a leading and ending character so that wildmatch only finds exact strings.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KGalloway_0-1696619049639.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/117822iEB6EB582D7F0662C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KGalloway_0-1696619049639.png" alt="KGalloway_0-1696619049639.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Oct 2023 19:04:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126205#M91650</guid>
      <dc:creator>KGalloway</dc:creator>
      <dc:date>2023-10-06T19:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a List from Excel and Setting as a Variable Value</title>
      <link>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126207#M91651</link>
      <description>&lt;P&gt;Update: What I have above works just fine. Another piece of my load statement wasn't correct which was causing it to appear to not work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 19:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Reading-a-List-from-Excel-and-Setting-as-a-Variable-Value/m-p/2126207#M91651</guid>
      <dc:creator>hannahnoelle797</dc:creator>
      <dc:date>2023-10-06T19:22:18Z</dc:date>
    </item>
  </channel>
</rss>

