<?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 Writing script to a text file in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255954#M96866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;SPAN class="replyToName"&gt;GandalfGray&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below macro in (first.qvw) will read a text file and writes it to another (recon.qvw) file. The text file contains SQL select statements. I am facing a issue with below code.&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;1. When I run the macro it just opens the recon.qvw file, but the script is not getting added. Please help. &lt;/P&gt;&lt;P&gt; &lt;BR /&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt; Padmasali&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;sub UpdateScriptFromfile&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;set FSO= createobject("Scripting.FilesystemObject")&lt;BR /&gt;set openReconFile=FSO.OpenTextFile("C:\Qlikview\buildsql.txt")&lt;BR /&gt;scriptBackup=openReconFile.ReadAll&lt;BR /&gt;openReconFile.Close&lt;BR /&gt;msgbox(scriptBackup)&lt;BR /&gt;set newdoc = GetObject("C:\Qlikview\recon.qvw")&lt;BR /&gt;newdoc.GetProperties.Script = scriptBackup&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Sep 2011 04:09:43 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-09-14T04:09:43Z</dc:date>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255949#M96861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Qlikview experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write below script to a text file, I have stored it to a variable called sampletable. How do I write it to a text file?&amp;nbsp; I am using STORE to do this, is this a correct way because i am getting error "Syntax error, missing/misplaced FROM:store". Please help with the syntax. Thank You all in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let sampletable = 'SQL SELECT sum($(qry_count_s1)),sum($(qry_count_s2)),sum($(qry_dur_s1)),sum($(qry_dur_s2)),&lt;/P&gt;&lt;P&gt;$(qry_s1)_$(qry_s2)_YEAR,&lt;/P&gt;&lt;P&gt;$(qry_s1)_$(qry_s2)_MONTH,&lt;/P&gt;&lt;P&gt;FROM $(qry_table_name) &lt;/P&gt;&lt;P&gt;group by &lt;/P&gt;&lt;P&gt;$(qry_s1)_$(qry_s2)_YEAR,&lt;/P&gt;&lt;P&gt;$(qry_s1)_$(qry_s2)_MONTH,&lt;/P&gt;&lt;P&gt;';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;store $(sampletable) into C:\Qlikview\buildsql.txt &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 07:35:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255949#M96861</guid>
      <dc:creator />
      <dc:date>2011-09-13T07:35:39Z</dc:date>
    </item>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255950#M96862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have to add a load statement between the "let" and "store" statement, like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;tab1:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load $(sampletable) autogenerate 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;store tab1 into C:\Qlikview\buildsql.txt (txt);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;Gilles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 07:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255950#M96862</guid>
      <dc:creator />
      <dc:date>2011-09-13T07:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255951#M96863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi padmasali!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Store command in load scripts is used to store tables only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could write the content of a variable to a file, using VB (that is, using Macro Script).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative is to get the variable in to a table (SampleTable in example below), like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;SampleTable:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Load * Inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SampleText&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SQL SELECT sum($(qry_count_s1)),sum($(qry_count_s2)),sum($(qry_dur_s1)),sum($(qry_dur_s2)),&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$(qry_s1)_$(qry_s2)_YEAR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$(qry_s1)_$(qry_s2)_MONTH,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM $(qry_table_name) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;group by &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$(qry_s1)_$(qry_s2)_YEAR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$(qry_s1)_$(qry_s2)_MONTH"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Store SampleTable Into C:\Qlikview\buildsql.txt (txt);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(There may be syntax errors above, but it shows the general idea anyway)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth/gg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: PS&lt;/P&gt;&lt;P&gt;Giles solution seems more elegant...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 08:04:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255951#M96863</guid>
      <dc:creator>gandalfgray</dc:creator>
      <dc:date>2011-09-13T08:04:47Z</dc:date>
    </item>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255952#M96864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Control+ E -&amp;gt; File meenu-&amp;gt;Export to script File &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then open into notepad&lt;/P&gt;&lt;P&gt;and save it &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 09:53:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255952#M96864</guid>
      <dc:creator>SunilChauhan</dc:creator>
      <dc:date>2011-09-13T09:53:22Z</dc:date>
    </item>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255953#M96865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks GandalfGray,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your response helped me in resolving.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 12:08:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255953#M96865</guid>
      <dc:creator />
      <dc:date>2011-09-13T12:08:01Z</dc:date>
    </item>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255954#M96866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;SPAN class="replyToName"&gt;GandalfGray&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below macro in (first.qvw) will read a text file and writes it to another (recon.qvw) file. The text file contains SQL select statements. I am facing a issue with below code.&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;1. When I run the macro it just opens the recon.qvw file, but the script is not getting added. Please help. &lt;/P&gt;&lt;P&gt; &lt;BR /&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt; Padmasali&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;sub UpdateScriptFromfile&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;set FSO= createobject("Scripting.FilesystemObject")&lt;BR /&gt;set openReconFile=FSO.OpenTextFile("C:\Qlikview\buildsql.txt")&lt;BR /&gt;scriptBackup=openReconFile.ReadAll&lt;BR /&gt;openReconFile.Close&lt;BR /&gt;msgbox(scriptBackup)&lt;BR /&gt;set newdoc = GetObject("C:\Qlikview\recon.qvw")&lt;BR /&gt;newdoc.GetProperties.Script = scriptBackup&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2011 04:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255954#M96866</guid>
      <dc:creator />
      <dc:date>2011-09-14T04:09:43Z</dc:date>
    </item>
    <item>
      <title>Writing script to a text file</title>
      <link>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255955#M96867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Padmasali&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not tried this myself, but I think you need to change the last line before end sub to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newdoc.SetProperties.Script = scriptBackup&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth/gg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2011 07:51:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Writing-script-to-a-text-file/m-p/255955#M96867</guid>
      <dc:creator>gandalfgray</dc:creator>
      <dc:date>2011-09-14T07:51:25Z</dc:date>
    </item>
  </channel>
</rss>

