<?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: Macro syntax help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584024#M216849</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately it doesn't work yet.&lt;/P&gt;&lt;P&gt;The macro seems ok - clicking on the "check" button does not produce any error, anyway.&lt;/P&gt;&lt;P&gt;I have added one more ELSE to allow for the case that no button was pressed - but maybe that isn't necessary as in that case (meaning the app was opened in another way), there is a clause anyway? I don't know for sure.&lt;/P&gt;&lt;P&gt;I'll post the code here.&lt;/P&gt;&lt;P&gt;Can you help me there?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Arbeitsblatt_Selektion&lt;/P&gt;&lt;P&gt;set sel = ActiveDocument.fields("Kennzahl").GetSelectedValues&lt;/P&gt;&lt;P&gt;if sel.count = 0 then exit sub&lt;/P&gt;&lt;P&gt;Kategorie = sel.Item(0).text&lt;/P&gt;&lt;P&gt;if Kategorie = "OPC" then&lt;/P&gt;&lt;P&gt;Kategorie = "SH24"&lt;/P&gt;&lt;P&gt;elseif Kategorie = "Forecast" then&lt;/P&gt;&lt;P&gt;Kategorie = "SH04"&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;Kategorie = "SH01"&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Sheets(Kategorie).Activate&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: I have now removed that extra ELSE branch (with the "SH01") since that case is accounted for by that EXIT clause at the beginning. Still it doesn't work: The selection (that text) is properly passed from the other app to this one, but the home_sheet opens, not the one I wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.P.S.: Since I don't know VB, I am m.o.l. guessing. I see there are two IF branches opened - one with the EXIT and then the big one. The big one is closed off properly - does the one with the EXIT need an END IF as well?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Mar 2014 07:26:48 GMT</pubDate>
    <dc:creator>datanibbler</dc:creator>
    <dc:date>2014-03-18T07:26:48Z</dc:date>
    <item>
      <title>Macro syntax help</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584021#M216846</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;can someone help me with the syntax of a macro? This does not seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Arbeitsblatt_Selektion&lt;/P&gt;&lt;P&gt;set sel = ActiveDocument.fields("__Kennzahl").GetSelectedValues&lt;/P&gt;&lt;P&gt;if sel.count = 0 then exit sub&lt;/P&gt;&lt;P&gt; Kategorie = sel.Item(0).text&lt;/P&gt;&lt;P&gt;if Kategorie = "OPC" then&lt;/P&gt;&lt;P&gt; Kategorie = "SH24"&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if Kategorie = "Forecast" then&lt;/P&gt;&lt;P&gt; Kategorie = "SH04"&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Sheets(Kategorie).Activate&lt;/P&gt;&lt;P&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has the purpose to open a specific worksheet in this app when the app is opened via document_chaining from a superposed management_dashboard. There is a failsafe for the case that the app is opened in the regular way.&lt;/P&gt;&lt;P&gt;(before I inserted the two or three lines in the "else" branch - when there was only the value "OPC" in the macro - it worked fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:22:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584021#M216846</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-03-17T15:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro syntax help</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584022#M216847</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;It looks like you are missing closing If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this,&lt;/P&gt;&lt;P&gt;sub Arbeitsblatt_Selektion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set sel = ActiveDocument.fields("__Kennzahl").GetSelectedValues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sel.count = 0 then exit sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kategorie = sel.Item(0).text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if Kategorie = "OPC" then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kategorie = "SH24"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Kategorie = "Forecast" then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kategorie = "SH04"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;End if&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Sheets(Kategorie).Activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;You can do like this also,&lt;/P&gt;&lt;P&gt;sub Arbeitsblatt_Selektion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set sel = ActiveDocument.fields("__Kennzahl").GetSelectedValues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sel.count = 0 then exit sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kategorie = sel.Item(0).text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if Kategorie = "OPC" then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kategorie = "SH24"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ElseIf Kategorie = "Forecast" then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kategorie = "SH04"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Sheets(Kategorie).Activate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:46:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584022#M216847</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2014-03-17T15:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro syntax help</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584023#M216848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;I'll try that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 06:40:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584023#M216848</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-03-18T06:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro syntax help</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584024#M216849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately it doesn't work yet.&lt;/P&gt;&lt;P&gt;The macro seems ok - clicking on the "check" button does not produce any error, anyway.&lt;/P&gt;&lt;P&gt;I have added one more ELSE to allow for the case that no button was pressed - but maybe that isn't necessary as in that case (meaning the app was opened in another way), there is a clause anyway? I don't know for sure.&lt;/P&gt;&lt;P&gt;I'll post the code here.&lt;/P&gt;&lt;P&gt;Can you help me there?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Arbeitsblatt_Selektion&lt;/P&gt;&lt;P&gt;set sel = ActiveDocument.fields("Kennzahl").GetSelectedValues&lt;/P&gt;&lt;P&gt;if sel.count = 0 then exit sub&lt;/P&gt;&lt;P&gt;Kategorie = sel.Item(0).text&lt;/P&gt;&lt;P&gt;if Kategorie = "OPC" then&lt;/P&gt;&lt;P&gt;Kategorie = "SH24"&lt;/P&gt;&lt;P&gt;elseif Kategorie = "Forecast" then&lt;/P&gt;&lt;P&gt;Kategorie = "SH04"&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;Kategorie = "SH01"&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&amp;nbsp; ActiveDocument.Sheets(Kategorie).Activate&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: I have now removed that extra ELSE branch (with the "SH01") since that case is accounted for by that EXIT clause at the beginning. Still it doesn't work: The selection (that text) is properly passed from the other app to this one, but the home_sheet opens, not the one I wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.P.S.: Since I don't know VB, I am m.o.l. guessing. I see there are two IF branches opened - one with the EXIT and then the big one. The big one is closed off properly - does the one with the EXIT need an END IF as well?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 07:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-syntax-help/m-p/584024#M216849</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-03-18T07:26:48Z</dc:date>
    </item>
  </channel>
</rss>

