<?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 Need to loop my script with set of values &amp;amp; pass the same into a variable name across the script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Need-to-loop-my-script-with-set-of-values-amp-pass-the-same-into/m-p/1536054#M38668</link>
    <description>&lt;P&gt;Need to loop my script with set of values &amp;amp; pass the same into a variable name across the script for internal usage. I think to go with for each loop, but please help to implement the same and also help to exit the for loop once&amp;nbsp;list of values to variables completed. Also i faced an issue when i tried this, like my next block code is not executed, so i concluded it as my for loop implementation is having issue. So, please help me to implement it from scratch.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;My Base Script:&lt;/P&gt;&lt;P&gt;Set&amp;nbsp;&lt;SPAN&gt;vTable = ''; // Need to send different values &amp;amp; based on the values my script should loop &amp;amp; execute.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If Alt(FileSize('$(vQVDRoot)\*Files.qvd'), 0) &amp;lt;= 0 then&lt;BR /&gt;set vFirstLoad=3;&lt;BR /&gt;ElseIf Alt(FileSize('$(vQVDRoot)\$(vTable)Log.qvd'), 0) &amp;lt;= 0 then&lt;BR /&gt;set vFirstLoad=1;&lt;BR /&gt;ElseIf Alt(FileSize('$(vQVDRoot)\$(vTable)Log.qvd'), 0) &amp;gt; 0 then&lt;BR /&gt;If Alt(FileSize('$(vQVDRoot)\*Files.qvd'), 0) &amp;gt; 0 then&lt;BR /&gt;set vFirstLoad=0;&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;if(vFirstLoad=1) then&lt;/P&gt;&lt;P&gt;For each LogFile in filelist( vQVDRoot &amp;amp; '\*Files.qvd')&lt;BR /&gt;Log:&lt;BR /&gt;LOAD SubField([File],'\',-1) as [File_Name],&lt;BR /&gt;SubField(FileBaseName('$(LogFile)'),'\',-1) as [SourceFileName],&lt;BR /&gt;'$(LogFile)' as [FileLocation], [File],&lt;BR /&gt;[FileUploadDate]&lt;BR /&gt;From [$(LogFile)] (qvd);&lt;BR /&gt;Next;&lt;BR /&gt;&lt;BR /&gt;Elseif(vFirstLoad=0) then&lt;/P&gt;&lt;P&gt;FOR Each File in filelist ('$(vQVDRoot)\*Files.qvd')&lt;BR /&gt;CurrentFileList:&lt;BR /&gt;Load '$(File)' as [File], Date(now()) as [FileUploadDate]&lt;BR /&gt;autogenerate 1;&lt;BR /&gt;next File&lt;/P&gt;&lt;P&gt;OldFileList:&lt;BR /&gt;LOAD [File] as [History]&lt;BR /&gt;FROM '$(vQVDRoot)\$(vTable)Log.qvd' (qvd);&lt;BR /&gt;&lt;BR /&gt;NoConcatenate&lt;BR /&gt;NewFiles:&lt;BR /&gt;Load [File] as [NewFile]&lt;BR /&gt;resident CurrentFileList&lt;BR /&gt;Where not exists([History], [File]);&lt;/P&gt;&lt;P&gt;If(Count([NewFiles])&amp;gt;0) then&lt;BR /&gt;Log:&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;For each LogFile in filelist('$(vQVDRoot)'&amp;amp;'\*Files.qvd')&lt;BR /&gt;Concatenate(Log)&lt;BR /&gt;LOAD SubField([File],'\',-1) as [File_Name],&lt;BR /&gt;SubField(FileBaseName('$(LogFile)'),'\',-1) as [SourceFileName],&lt;BR /&gt;'$(LogFile)' as [FileLocation], [File],&lt;BR /&gt;[FileUploadDate]&lt;BR /&gt;FROM '$(LogFile)' (qvd);&lt;/P&gt;&lt;P&gt;SET Concatenate = concatenate;&lt;/P&gt;&lt;P&gt;Next;&lt;BR /&gt;End if;&lt;BR /&gt;Elseif(vFirstLoad=3) then&lt;BR /&gt;Trace Log File Does not Exist!;&lt;BR /&gt;END IF&lt;/P&gt;&lt;P&gt;If(vFirstLoad=3) then&lt;BR /&gt;Trace Log File Does not Exist!;&lt;BR /&gt;Elseif(vFirstLoad=1) then&lt;BR /&gt;STORE Log into [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;Drop table Log;&lt;BR /&gt;Elseif(vFirstLoad=0) then&lt;BR /&gt;If(Count([NewFiles])&amp;gt;0) then&lt;BR /&gt;STORE Log into [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;Drop Tables Log,CurrentFileList,OldFileList,NewFiles;&lt;BR /&gt;End If;&lt;BR /&gt;End if;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nandhakumar&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 21:31:09 GMT</pubDate>
    <dc:creator>nandhaadjame200</dc:creator>
    <dc:date>2024-11-16T21:31:09Z</dc:date>
    <item>
      <title>Need to loop my script with set of values &amp; pass the same into a variable name across the script</title>
      <link>https://community.qlik.com/t5/App-Development/Need-to-loop-my-script-with-set-of-values-amp-pass-the-same-into/m-p/1536054#M38668</link>
      <description>&lt;P&gt;Need to loop my script with set of values &amp;amp; pass the same into a variable name across the script for internal usage. I think to go with for each loop, but please help to implement the same and also help to exit the for loop once&amp;nbsp;list of values to variables completed. Also i faced an issue when i tried this, like my next block code is not executed, so i concluded it as my for loop implementation is having issue. So, please help me to implement it from scratch.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;My Base Script:&lt;/P&gt;&lt;P&gt;Set&amp;nbsp;&lt;SPAN&gt;vTable = ''; // Need to send different values &amp;amp; based on the values my script should loop &amp;amp; execute.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If Alt(FileSize('$(vQVDRoot)\*Files.qvd'), 0) &amp;lt;= 0 then&lt;BR /&gt;set vFirstLoad=3;&lt;BR /&gt;ElseIf Alt(FileSize('$(vQVDRoot)\$(vTable)Log.qvd'), 0) &amp;lt;= 0 then&lt;BR /&gt;set vFirstLoad=1;&lt;BR /&gt;ElseIf Alt(FileSize('$(vQVDRoot)\$(vTable)Log.qvd'), 0) &amp;gt; 0 then&lt;BR /&gt;If Alt(FileSize('$(vQVDRoot)\*Files.qvd'), 0) &amp;gt; 0 then&lt;BR /&gt;set vFirstLoad=0;&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;if(vFirstLoad=1) then&lt;/P&gt;&lt;P&gt;For each LogFile in filelist( vQVDRoot &amp;amp; '\*Files.qvd')&lt;BR /&gt;Log:&lt;BR /&gt;LOAD SubField([File],'\',-1) as [File_Name],&lt;BR /&gt;SubField(FileBaseName('$(LogFile)'),'\',-1) as [SourceFileName],&lt;BR /&gt;'$(LogFile)' as [FileLocation], [File],&lt;BR /&gt;[FileUploadDate]&lt;BR /&gt;From [$(LogFile)] (qvd);&lt;BR /&gt;Next;&lt;BR /&gt;&lt;BR /&gt;Elseif(vFirstLoad=0) then&lt;/P&gt;&lt;P&gt;FOR Each File in filelist ('$(vQVDRoot)\*Files.qvd')&lt;BR /&gt;CurrentFileList:&lt;BR /&gt;Load '$(File)' as [File], Date(now()) as [FileUploadDate]&lt;BR /&gt;autogenerate 1;&lt;BR /&gt;next File&lt;/P&gt;&lt;P&gt;OldFileList:&lt;BR /&gt;LOAD [File] as [History]&lt;BR /&gt;FROM '$(vQVDRoot)\$(vTable)Log.qvd' (qvd);&lt;BR /&gt;&lt;BR /&gt;NoConcatenate&lt;BR /&gt;NewFiles:&lt;BR /&gt;Load [File] as [NewFile]&lt;BR /&gt;resident CurrentFileList&lt;BR /&gt;Where not exists([History], [File]);&lt;/P&gt;&lt;P&gt;If(Count([NewFiles])&amp;gt;0) then&lt;BR /&gt;Log:&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;For each LogFile in filelist('$(vQVDRoot)'&amp;amp;'\*Files.qvd')&lt;BR /&gt;Concatenate(Log)&lt;BR /&gt;LOAD SubField([File],'\',-1) as [File_Name],&lt;BR /&gt;SubField(FileBaseName('$(LogFile)'),'\',-1) as [SourceFileName],&lt;BR /&gt;'$(LogFile)' as [FileLocation], [File],&lt;BR /&gt;[FileUploadDate]&lt;BR /&gt;FROM '$(LogFile)' (qvd);&lt;/P&gt;&lt;P&gt;SET Concatenate = concatenate;&lt;/P&gt;&lt;P&gt;Next;&lt;BR /&gt;End if;&lt;BR /&gt;Elseif(vFirstLoad=3) then&lt;BR /&gt;Trace Log File Does not Exist!;&lt;BR /&gt;END IF&lt;/P&gt;&lt;P&gt;If(vFirstLoad=3) then&lt;BR /&gt;Trace Log File Does not Exist!;&lt;BR /&gt;Elseif(vFirstLoad=1) then&lt;BR /&gt;STORE Log into [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;Drop table Log;&lt;BR /&gt;Elseif(vFirstLoad=0) then&lt;BR /&gt;If(Count([NewFiles])&amp;gt;0) then&lt;BR /&gt;STORE Log into [$(vQVDRoot)\$(vTable)Log.qvd] (qvd);&lt;/P&gt;&lt;P&gt;Drop Tables Log,CurrentFileList,OldFileList,NewFiles;&lt;BR /&gt;End If;&lt;BR /&gt;End if;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nandhakumar&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 21:31:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Need-to-loop-my-script-with-set-of-values-amp-pass-the-same-into/m-p/1536054#M38668</guid>
      <dc:creator>nandhaadjame200</dc:creator>
      <dc:date>2024-11-16T21:31:09Z</dc:date>
    </item>
  </channel>
</rss>

