<?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: Setting OneAndOnlyOne Dynamically in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410917#M696497</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Here is what QlikTech says about macro in the reference manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt; font-family: ArialMT;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;82.2 Macro functionality limitations&lt;/P&gt;&lt;P&gt;Functionality that will normally work well in macros in the QlikView Server environment with any type of&lt;/P&gt;&lt;P&gt;client is:&lt;/P&gt;&lt;P&gt;l Logical operations such as clearing or selecting in fields&lt;/P&gt;&lt;P&gt;l Operations related to variables&lt;/P&gt;&lt;P&gt;The following types of functionality are not to be used in the QlikView Server environment , as they may&lt;/P&gt;&lt;P&gt;cause unexpected results:&lt;/P&gt;&lt;P&gt;l Layout operations acting on the properties of sheets and sheet objects via SetProperties&lt;/P&gt;&lt;P&gt;l Operations changing document or user settings&lt;/P&gt;&lt;P&gt;l All operations related to the script, including Reload&lt;/P&gt;&lt;P&gt;l Data reduction operations, e.g. ReduceData&lt;/P&gt;&lt;P&gt;l Operations such as Save and Open document&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And thus your macro will not work over browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Apr 2013 12:54:58 GMT</pubDate>
    <dc:creator>kaushiknsolanki</dc:creator>
    <dc:date>2013-04-02T12:54:58Z</dc:date>
    <item>
      <title>Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410914#M696494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For one tab in our dashboard, it is a requirement to have the Product Name field's OneAndOnlyOne property set to true. Therefore, I've written a macro that fires on the sheet's OnActivateSheet trigger. The macro looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13648401944772280" jivemacro_uid="_13648401944772280"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUB AlwaysOneSelected()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET fld = ActiveDocument.GetField("Product Name")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET selections = fld.GetSelectedValues&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (selections.Count = 0) THEN&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionText = "Product X"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionText = selections.Item(0).text&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END IF&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld.Select selectionText&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET fprop = fld.GetProperties&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fprop.OneAndOnlyOne = True&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld.SetProperties fprop&lt;BR /&gt;END SUB&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works just as intended in my developer copy of the dashboard. The OneAndOnlyOne property is set when I enter the tab, so I must always have exactly one selection in the Product Name field. If I switch to WebView in my development environment, it still works as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, when the QVW is posted to our server, this functionality breaks, regardless of whether we use the IE plugin or the standard webview in other browsers. I know that the macro is successfully triggered because if I enter the tab with no selection in the Product Name field, Product X gets selected. Yet, the OneAndOnlyOne property is not set; I can clear the field or select multiple product names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas? Could this be a bug?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:26:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410914#M696494</guid>
      <dc:creator />
      <dc:date>2013-04-01T18:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410915#M696495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd expect it to work in IE plugin but not in webview or other browsers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 21:06:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410915#M696495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-01T21:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410916#M696496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why wouldn't you expect this to work in all browsers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 12:49:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410916#M696496</guid>
      <dc:creator />
      <dc:date>2013-04-02T12:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410917#M696497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Here is what QlikTech says about macro in the reference manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt; font-family: ArialMT;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;82.2 Macro functionality limitations&lt;/P&gt;&lt;P&gt;Functionality that will normally work well in macros in the QlikView Server environment with any type of&lt;/P&gt;&lt;P&gt;client is:&lt;/P&gt;&lt;P&gt;l Logical operations such as clearing or selecting in fields&lt;/P&gt;&lt;P&gt;l Operations related to variables&lt;/P&gt;&lt;P&gt;The following types of functionality are not to be used in the QlikView Server environment , as they may&lt;/P&gt;&lt;P&gt;cause unexpected results:&lt;/P&gt;&lt;P&gt;l Layout operations acting on the properties of sheets and sheet objects via SetProperties&lt;/P&gt;&lt;P&gt;l Operations changing document or user settings&lt;/P&gt;&lt;P&gt;l All operations related to the script, including Reload&lt;/P&gt;&lt;P&gt;l Data reduction operations, e.g. ReduceData&lt;/P&gt;&lt;P&gt;l Operations such as Save and Open document&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And thus your macro will not work over browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 12:54:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410917#M696497</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2013-04-02T12:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410918#M696498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This macro is changing object properties.&amp;nbsp; Not something that I expect to work in AJAX.&amp;nbsp; The only relaible macros for AJAX are those that make selections and modify variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 12:57:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410918#M696498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-02T12:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410919#M696499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Kaushik &amp;amp; Michael. Without using a macro, is there any way to change object properties at runtime? Any other way to get the desired behavior?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 13:03:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410919#M696499</guid>
      <dc:creator />
      <dc:date>2013-04-02T13:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410920#M696500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you set up this property initially in the QV application and save it, it should keep this property, unless there is a chance that after reload the filed in question may end up empty.&amp;nbsp; Or if you remove all data.&amp;nbsp; So, in "normal" situation you don't need to set it up dynamically.&lt;/P&gt;&lt;P&gt;I can only add that this macro should work in IE Plugin.&amp;nbsp; Frankly I'm trying to avoid using macros altogether because of AJAX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 13:09:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410920#M696500</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-02T13:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Setting OneAndOnlyOne Dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410921#M696501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For my dashboard, I need to force unique values on some tabs and not on others. So, I've devised a work-around as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I added a variabled (vForceOne) that is set to true/false when the tab requiring one and only one field selection is entered/exited.&lt;/LI&gt;&lt;LI&gt;I modified my macro to be the following:&lt;/LI&gt;&lt;/OL&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1364919645053126" jivemacro_uid="_1364919645053126"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUB AlwaysOneProductSelected()&lt;/P&gt;&lt;P&gt; IF (ActiveDocument.Variables("vForceOneProduct").GetContent.string = "True") THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET fld = ActiveDocument.GetField("Product Name")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET selections = fld.GetSelectedValues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (selections.Count = 0) THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionText = "Product X"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionText = selections.Item(0).text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END IF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld.Select selectionText&lt;/P&gt;&lt;P&gt;&amp;nbsp; END IF&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;3.&amp;nbsp;&amp;nbsp; I added a trigger to the product field to fire the macro whenever the selection is changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In essense, my macro is now providing the functionality that would usually be provided by the OneAndOnlyOne field property. The only problem is that the macro doesn't fire when shift+click selection is used. (See &lt;A _jive_internal="true" href="https://community.qlik.com/message/329011"&gt;http://community.qlik.com/message/329011&lt;/A&gt;.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 16:54:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-OneAndOnlyOne-Dynamically/m-p/410921#M696501</guid>
      <dc:creator />
      <dc:date>2013-04-02T16:54:17Z</dc:date>
    </item>
  </channel>
</rss>

