<?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 Re: macros are not working as expected...? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1747135#M453379</link>
    <description>&lt;P&gt;Hi Marcus, every thing was fine until we got the small change in the macro, now there is a error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;please guide us,&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with the below macro,&lt;/P&gt;&lt;P&gt;we are trying to place the generated text files in the&amp;nbsp;\\qlkvapps001.flip.onmicrosoft.com\WUR folder for which we added few lines line Dim FilePath and thats it.&lt;/P&gt;&lt;P&gt;am getting &lt;STRONG&gt;bad file name or number&lt;/STRONG&gt; error and this line is getting highlighted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set MyFile = fso.CreateTextFile(strFile)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full Macro :&lt;/P&gt;&lt;P&gt;Sub export&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;curMonth = Month( DateAdd("M",-1, Date))&lt;BR /&gt;if curMonth&amp;lt;10 then curMonthS="0" &amp;amp; CStr(curMonth) else curMonthS=CStr(curMonth)&lt;BR /&gt;IF curMonth=1 OR curMonth=3 OR curMonth=5 OR curMonth=7 OR curMonth=8 OR curMonth=10 OR curMonth=12 Then&lt;BR /&gt;noofdays=31&lt;BR /&gt;else noofdays=30&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;Dim wellNames(2)&lt;BR /&gt;wellNames(0)="Eschenfelden US"&lt;BR /&gt;wellNames(1)="Bierwang US"&lt;/P&gt;&lt;P&gt;Dim FileNames(2)&lt;BR /&gt;FileNames(0)="Esch"&lt;BR /&gt;FileNames(1)="Biew"&lt;/P&gt;&lt;P&gt;Dim FilePath(1)&lt;BR /&gt;FilePath(1) = "\\qlkvapps001.flip.onmicrosoft.com\WUR"&lt;/P&gt;&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;For i = 0 to 1&lt;BR /&gt;ActiveDocument.Fields("%KEY_REPORT").Select WCONHIST,WCONINJH&lt;BR /&gt;ActiveDocument.Fields("GASMONTH").Select Year(Date)&amp;amp;"-"&amp;amp;curMonthS&lt;BR /&gt;ActiveDocument.Fields("SP.LANGBEZ_SSO_SPEICHER").Select wellNames(i)&lt;BR /&gt;&lt;BR /&gt;strFile = FilePath(i) &amp;amp; FileNames(i) &amp;amp; "_UGS_01_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; noofdays &amp;amp; "_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; Year(Date) &amp;amp; ".txt"&lt;BR /&gt;&lt;BR /&gt;Set MyFile = fso.CreateTextFile(strFile)&lt;BR /&gt;&lt;BR /&gt;set table = ActiveDocument.GetSheetObject( "TB02" )&lt;BR /&gt;for RowIter = 0 to table.GetRowCount-1&lt;BR /&gt;set cell = table.GetCell(RowIter,0)&lt;BR /&gt;MyFile.WriteLine(cell.Text)&lt;BR /&gt;next&lt;BR /&gt;MyFile.Close&lt;BR /&gt;Next&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;ActiveDocument.Save&lt;BR /&gt;ActiveDocument.GetApplication.Quit&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;</description>
    <pubDate>Fri, 25 Sep 2020 11:03:08 GMT</pubDate>
    <dc:creator>dhasharadh</dc:creator>
    <dc:date>2020-09-25T11:03:08Z</dc:date>
    <item>
      <title>macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744654#M453181</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;as per our requirement we have to use 2 macros, when we use individually its both are working fine. but combining together its not working as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please look into attached. Thanks Much in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22678"&gt;@jagan&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22949"&gt;@tresB&lt;/a&gt;&amp;nbsp; can any one you please look into this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Dhasharadh.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:57:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744654#M453181</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2024-11-15T23:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744672#M453186</link>
      <description>&lt;P&gt;My suggestion is to apply all selections within the export-macro and then calling it per OnReload trigger and maybe also applying it to a button.&lt;/P&gt;&lt;P&gt;Beside this such logig could only work directly within the desktop client and not by reloading the app per qmc.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 09:48:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744672#M453186</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-17T09:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744719#M453188</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;thanks much marcus, but here on reload trigger is not working as expected seems like a bug i guess, i read it in one article regarding the same that postreload and postreduce data triggers are not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;here the challenge is we can not write the button press trigger in the same macro, as the same macro triggered with the button.&lt;/P&gt;&lt;P&gt;and added all other selections in the same macro and just tried using the postreload trigger but didnt worked.&lt;/P&gt;&lt;P&gt;so to trigger the macro we have to use a button and to trigger the button we need an other macro which is not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any way to run the macro without using this button option or onpostreload option...??&lt;/P&gt;&lt;P&gt;Much appreciate your time Marcus. Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Dhasharadh&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 08:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1744719#M453188</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-18T08:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745013#M453223</link>
      <description>&lt;P&gt;If the export-macro didn't worked because it wasn't triggered from the OnReload trigger why should another macro in-between be helpful to trigger further things - if a macro isn't triggered it won't help if you chained or nest the macros/actions in any way. Means here just to add further complexity but not on the cause else on the impact.&lt;/P&gt;&lt;P&gt;Whereby the above said mustn't be really true. How do you check if the macro was triggered and executed or not? Just to look if there are new export-files is not enough because there are various reasons why the export may fail.&lt;/P&gt;&lt;P&gt;Please elaborate how and where the application is from which user reloaded? In which scenarios does it work (partly) and in which not? If not, what happens - errors, unexpected results, nothing?&lt;/P&gt;&lt;P&gt;- Marcus&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:01:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745013#M453223</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-18T10:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745019#M453226</link>
      <description>&lt;P&gt;Thanks Marcus,&amp;nbsp;&lt;/P&gt;&lt;P&gt;the application is in our dev environment, and it is not going to be scheduled in QMC, we are planning to trigger it on 5th of every month using windows task scheduler.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we wrote attached macro and used a button to run that macro, whenever we click on that button macro is getting executed and files are generated in the required format, but this macro have to run on its own without any manual task.&amp;nbsp;&lt;/P&gt;&lt;P&gt;and we used on post reload option which is not working, that is that reason we wrote an other macro to trigger the button, but unfortunately that is also not working as expected.&lt;/P&gt;&lt;P&gt;if you observe the macro we wrote msg like completed ( whenever the macro runs it will pop up a msg like completed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 10:22:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745019#M453226</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-18T10:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745189#M453251</link>
      <description>&lt;P&gt;You should have mentioned a windows-task execution per batch earlier - that is not really the same like &lt;U&gt;using&lt;/U&gt; the desktop client. I assume you use /r as parameter which worked like a qmc-execution which hasn't an UI and could therefore not execute any macros, see:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-App-Development/Just-reload-whitout-Publisher/m-p/1636515" target="_self"&gt;Just-reload-whitout-Publisher&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 15:36:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745189#M453251</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-18T15:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745461#M453278</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;, sorry i actually over looked i used post reduce option by mistake, when i used on post reload its working perfectly fine and am able to generate the files as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as macro based apps are not executed in QMC, we have to&amp;nbsp; use windows batch scheduler to schedule this app, when i use /r in between qv.exe file and app name its just reloading but macro is not running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i have to use in batch file to execute the app fully including macros.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 06:15:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745461#M453278</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-21T06:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745476#M453281</link>
      <description>&lt;P&gt;The command-line with /r parameter ist the same like the qmc-execution but you could use /l as parameter. With it the entire desktop client will be loaded but didn't save + close after the reload and any macro-execution - this means you need to add a save + close + quit macro-statements at the end of your macro to keep the task automatically. To the proper syntax for it take a look within the APIGuide.qvw.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 06:54:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1745476#M453281</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-09-21T06:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: macros are not working as expected...?</title>
      <link>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1747135#M453379</link>
      <description>&lt;P&gt;Hi Marcus, every thing was fine until we got the small change in the macro, now there is a error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;please guide us,&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with the below macro,&lt;/P&gt;&lt;P&gt;we are trying to place the generated text files in the&amp;nbsp;\\qlkvapps001.flip.onmicrosoft.com\WUR folder for which we added few lines line Dim FilePath and thats it.&lt;/P&gt;&lt;P&gt;am getting &lt;STRONG&gt;bad file name or number&lt;/STRONG&gt; error and this line is getting highlighted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set MyFile = fso.CreateTextFile(strFile)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Full Macro :&lt;/P&gt;&lt;P&gt;Sub export&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;curMonth = Month( DateAdd("M",-1, Date))&lt;BR /&gt;if curMonth&amp;lt;10 then curMonthS="0" &amp;amp; CStr(curMonth) else curMonthS=CStr(curMonth)&lt;BR /&gt;IF curMonth=1 OR curMonth=3 OR curMonth=5 OR curMonth=7 OR curMonth=8 OR curMonth=10 OR curMonth=12 Then&lt;BR /&gt;noofdays=31&lt;BR /&gt;else noofdays=30&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;Dim wellNames(2)&lt;BR /&gt;wellNames(0)="Eschenfelden US"&lt;BR /&gt;wellNames(1)="Bierwang US"&lt;/P&gt;&lt;P&gt;Dim FileNames(2)&lt;BR /&gt;FileNames(0)="Esch"&lt;BR /&gt;FileNames(1)="Biew"&lt;/P&gt;&lt;P&gt;Dim FilePath(1)&lt;BR /&gt;FilePath(1) = "\\qlkvapps001.flip.onmicrosoft.com\WUR"&lt;/P&gt;&lt;P&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;For i = 0 to 1&lt;BR /&gt;ActiveDocument.Fields("%KEY_REPORT").Select WCONHIST,WCONINJH&lt;BR /&gt;ActiveDocument.Fields("GASMONTH").Select Year(Date)&amp;amp;"-"&amp;amp;curMonthS&lt;BR /&gt;ActiveDocument.Fields("SP.LANGBEZ_SSO_SPEICHER").Select wellNames(i)&lt;BR /&gt;&lt;BR /&gt;strFile = FilePath(i) &amp;amp; FileNames(i) &amp;amp; "_UGS_01_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; noofdays &amp;amp; "_" &amp;amp; curMonthS &amp;amp; "_" &amp;amp; Year(Date) &amp;amp; ".txt"&lt;BR /&gt;&lt;BR /&gt;Set MyFile = fso.CreateTextFile(strFile)&lt;BR /&gt;&lt;BR /&gt;set table = ActiveDocument.GetSheetObject( "TB02" )&lt;BR /&gt;for RowIter = 0 to table.GetRowCount-1&lt;BR /&gt;set cell = table.GetCell(RowIter,0)&lt;BR /&gt;MyFile.WriteLine(cell.Text)&lt;BR /&gt;next&lt;BR /&gt;MyFile.Close&lt;BR /&gt;Next&lt;BR /&gt;ActiveDocument.clearAll true&lt;BR /&gt;ActiveDocument.Save&lt;BR /&gt;ActiveDocument.GetApplication.Quit&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 11:03:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/macros-are-not-working-as-expected/m-p/1747135#M453379</guid>
      <dc:creator>dhasharadh</dc:creator>
      <dc:date>2020-09-25T11:03:08Z</dc:date>
    </item>
  </channel>
</rss>

