<?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 call sub from script issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236187#M87389</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While not an answer to your OP, another option is to do your logging in script instead of a macro. There's nothing in your example that can't be done in script -- without needing system access. See attached example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 May 2011 00:18:38 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2011-05-02T00:18:38Z</dc:date>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236183#M87385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;I'm trying to call a sub from a script page. I'm sure it is something simple but I can't find it.&lt;/P&gt;&lt;P&gt;This is a qvd builder and I'm calling the logger sub from within a loop. the error I get is "error calling logger".&lt;/P&gt;&lt;P&gt;thanks for any thoughts..&lt;/P&gt;&lt;P&gt;---------------------------------------&lt;/P&gt;&lt;P&gt;SUB logger&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set tn = ActiveDocument.Variables("_table_name").GetContent.String&lt;/P&gt;&lt;P&gt;set qn = ActiveDocument.Variables("_qvd_name").GetContent.String&lt;/P&gt;&lt;P&gt;set r = ActiveDocument.Variables("_result").GetContent.String&lt;/P&gt;&lt;P&gt;DIM fso, MyFile, strFile, strText&lt;/P&gt;&lt;P&gt;strFile="C:\qlikview_logs\log.log"&lt;/P&gt;&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If fso.FileExists(strFile) Then&lt;/P&gt;&lt;P&gt;Set MyFile = fso.OpenTextFile (strFile, 8, True)&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;Set MyFile = fso.CreateTextFile(strFile)&lt;/P&gt;&lt;P&gt;MyFile.WriteLine("log_dtm,table_name,qvd_name,result")&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;strText = Now() &amp;amp; "," &amp;amp; tn &amp;amp; "," &amp;amp; qn &amp;amp; "," &amp;amp; r&lt;/P&gt;&lt;P&gt;MyFile.WriteLine(strText)&lt;/P&gt;&lt;P&gt;MyFile.Close&lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SCRIPT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(Include=C:\qlikview_config\config.vbs);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// SEE CONFIG FILE ABOVE on the target system or Ctrl + Alt + V in QV for variables overview&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//SET _qvd_name='choa.qlikview_qvd_tables';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// include connect file&lt;/P&gt;&lt;P&gt;$(Include=$(_include_path)connect_odbc_qlikview.txt);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:&lt;/P&gt;&lt;P&gt;SELECT * FROM CHOA.QLIKVIEW_QVD_TABLES&lt;/P&gt;&lt;P&gt;WHERE ACTIVE = 'Y'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let rows = NoOfRows('tables');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i=0 to $(rows)-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let _table_name = peek('TABLE_NAME',$(i),'tables');&lt;/P&gt;&lt;P&gt;let _qvd_name = peek('QVD_NAME',$(i),'tables');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(_qvd_name):&lt;/P&gt;&lt;P&gt;SELECT * FROM $(_table_name);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ERRORCOUNT = 0 or IsNull(ERRORCOUNT) THEN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STORE $(_qvd_name) INTO $(_qvd_path)$(_qvd_name).qvd (qvd);&lt;/P&gt;&lt;P&gt;DROP TABLE $(_qvd_name);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let _result = 'ok';&lt;/P&gt;&lt;P&gt;CALL LOGGER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let _result = 'error';&lt;/P&gt;&lt;P&gt;CALL LOGGER&lt;/P&gt;&lt;P&gt;ENDIF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 13:50:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236183#M87385</guid>
      <dc:creator />
      <dc:date>2011-04-30T13:50:40Z</dc:date>
    </item>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236184#M87386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand you code correctly, you are trying to call a VB subroutine from a load script... You can't do it using CALL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL is used when you need to call a load script sub. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Test&lt;/P&gt;&lt;P&gt;load .....&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;CALL Test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the only way to call a VBScript routine is to include it as a function in a load statement. I might be wrong though, since I haven't done too much of that...&lt;/P&gt;&lt;P&gt;Something like this should work (can't guarantee the exact syntax):&lt;/P&gt;&lt;P&gt;VBScript:&lt;/P&gt;&lt;P&gt;function Test (parm1, parm2)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;end function&lt;/P&gt;&lt;P&gt;----------------&lt;/P&gt;&lt;P&gt;Load script:&lt;/P&gt;&lt;P&gt;Dummy:&lt;/P&gt;&lt;P&gt;load Test(1,2) as DummyField&lt;/P&gt;&lt;P&gt;autogenerate(1)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2011 16:20:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236184#M87386</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-04-30T16:20:04Z</dc:date>
    </item>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236185#M87387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Oleg. It does not appear that my FileSystemObject is available from the script page so I'll have to go another direction. I appreciate your input&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2011 12:03:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236185#M87387</guid>
      <dc:creator />
      <dc:date>2011-05-01T12:03:52Z</dc:date>
    </item>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236186#M87388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Tod ,&lt;/P&gt;&lt;P&gt;instead of using "Call" :&lt;/P&gt;&lt;P&gt;In the script line try using this variable decleration :&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;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Let&lt;/B&gt; vEngage_Sub = LOGGER() ;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It might do the trick ...&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Moshe Golan&lt;/P&gt;&lt;P&gt;QlikView Consultant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2011 12:36:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236186#M87388</guid>
      <dc:creator />
      <dc:date>2011-05-01T12:36:59Z</dc:date>
    </item>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236187#M87389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While not an answer to your OP, another option is to do your logging in script instead of a macro. There's nothing in your example that can't be done in script -- without needing system access. See attached example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 00:18:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236187#M87389</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-05-02T00:18:38Z</dc:date>
    </item>
    <item>
      <title>call sub from script issue</title>
      <link>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236188#M87390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob, it looks like that will work. Actually I was trying to avoid using a module but I couldn't figure out how.&lt;/P&gt;&lt;P&gt;I will miss not having total control over the document with an fso but I'm not really sure I'll need it.&lt;/P&gt;&lt;P&gt;Thanks to all that posted&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 01:03:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/call-sub-from-script-issue/m-p/236188#M87390</guid>
      <dc:creator />
      <dc:date>2011-05-02T01:03:55Z</dc:date>
    </item>
  </channel>
</rss>

