<?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: Getting active selections using the SDK: problem with locked fields in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015344#M17740</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/16584"&gt;@master_t&lt;/a&gt; when you create the ListObjectDef object try to set ShowAlternatives property to true. In this way you should receive all values. &lt;A href="https://help.qlik.com/en-US/sense-developer/May2022/Subsystems/NetSDKAPIref/Content/Qlik.Engine.ListObjectDef.ShowAlternatives.htm" target="_blank"&gt;Here &lt;/A&gt;our doc and &lt;A href="https://community.qlik.com/t5/Integration-Extension-APIs/JavaScript-API-How-to-get-all-selected-values-including-excluded/td-p/1988893" target="_blank"&gt;here &lt;/A&gt;an example but with Capability APIs.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2022 11:01:02 GMT</pubDate>
    <dc:creator>alex_colombo</dc:creator>
    <dc:date>2022-12-12T11:01:02Z</dc:date>
    <item>
      <title>Getting active selections using the SDK: problem with locked fields</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2013100#M17712</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;
&lt;P&gt;I'm trying to use the .NET SDK to get all the active selections in a Qlik Sense app.&lt;/P&gt;
&lt;P&gt;At the moment I'm using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;public void GetCurrentSelections()
{
    IApp app = GetApp();
    using (var currentSelection = app.GetCurrentSelection())
    {
        foreach (var item in currentSelection)
        {
            Listbox listBoxObj = app.CreateGenericSessionObject(new ListboxProperties()
            {
                ListObjectDef = new ListboxListObjectDef()
                {
                    Def = new ListboxListObjectDimensionDef { FieldDefs = new string[] { item.Field } },
                    InitialDataFetch = new NxPage[] { new NxPage { Height = 10000, Left = 0, Top = 0, Width = 1 } },
                    AutoSortByState = new NxAutoSortByStateDef() { DisplayNumberOfRows = 1 },
                },
                Info = new NxInfo() { Type = "listbox" },
            }) as Listbox;

            foreach (var dataPage in listBoxObj.Layout.ListObject.DataPages)
            {
                foreach (NxCellRows rows in dataPage.Matrix)
                {
                    foreach (var cell in rows)
                    {
                        Console.WriteLine($"Value {cell.Text} is {cell.State}");
                    }
                }
            }

            app.DestroyGenericSessionObject(listBoxObj.Id);
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, I get the list of fields with active selections and for each one I find the locked/selected/etc. states of each value by building a session object ListBox and fetching the items.&lt;/P&gt;
&lt;P&gt;However, there's something wrong going on: I'm having problems with detecting values that are LOCKED but EXCLUDED. Instead of having the StateEnumType.EXCL_LOCKED state, values that are both locked and excluded simply have the&amp;nbsp; StateEnumType.EXCLUDED state.&lt;/P&gt;
&lt;P&gt;For example, in a situation like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="master_t_0-1670323137279.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/95507i27291AA793746AE1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="master_t_0-1670323137279.png" alt="master_t_0-1670323137279.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the above function prints:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Value Non-Sponsored Trial is LOCKED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Value Sponsored Trial is EXCLUDED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Value Compassionate Use is EXCLUDED&lt;BR /&gt;etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Is this a bug? Or am I doing this wrong?&lt;/P&gt;
&lt;P&gt;Note that in the NxCurrentSelectionItem object (the "item" in the outer most for-each in my function) the state count sseems to be correctly reported, as you can see here:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="master_t_1-1670323761195.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/95508iB11B624C52DD6BFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="master_t_1-1670323761195.png" alt="master_t_1-1670323761195.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 10:58:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2013100#M17712</guid>
      <dc:creator>master_t</dc:creator>
      <dc:date>2022-12-06T10:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting active selections using the SDK: problem with locked fields</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015344#M17740</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/16584"&gt;@master_t&lt;/a&gt; when you create the ListObjectDef object try to set ShowAlternatives property to true. In this way you should receive all values. &lt;A href="https://help.qlik.com/en-US/sense-developer/May2022/Subsystems/NetSDKAPIref/Content/Qlik.Engine.ListObjectDef.ShowAlternatives.htm" target="_blank"&gt;Here &lt;/A&gt;our doc and &lt;A href="https://community.qlik.com/t5/Integration-Extension-APIs/JavaScript-API-How-to-get-all-selected-values-including-excluded/td-p/1988893" target="_blank"&gt;here &lt;/A&gt;an example but with Capability APIs.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 11:01:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015344#M17740</guid>
      <dc:creator>alex_colombo</dc:creator>
      <dc:date>2022-12-12T11:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting active selections using the SDK: problem with locked fields</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015421#M17742</link>
      <description>&lt;P&gt;Like &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145804"&gt;@alex_colombo&lt;/a&gt; writes, that "ShowAlternatives" setting is probably what you want. Try defining your ListObjectDef like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;ListObjectDef = new ListboxListObjectDef()
{
    Def = new ListboxListObjectDimensionDef { FieldDefs = new string[] { item.Field } },
    InitialDataFetch = new NxPage[] { new NxPage { Height = 10000, Left = 0, Top = 0, Width = 1 } },
    AutoSortByState = new NxAutoSortByStateDef() { DisplayNumberOfRows = 1 },
    ShowAlternatives = true
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 13:06:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015421#M17742</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2022-12-12T13:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Getting active selections using the SDK: problem with locked fields</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015483#M17743</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145804"&gt;@alex_colombo&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/41242"&gt;@Øystein_Kolsrud&lt;/a&gt;&amp;nbsp;, your solution worked perfectly.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 14:37:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Getting-active-selections-using-the-SDK-problem-with-locked/m-p/2015483#M17743</guid>
      <dc:creator>master_t</dc:creator>
      <dc:date>2022-12-12T14:37:21Z</dc:date>
    </item>
  </channel>
</rss>

