<?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: .NET To read Table Cells returned from a Hypercube in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550709#M10091</link>
    <description>&lt;P&gt;Good! I'm glad you were able to make progress!&lt;/P&gt;
&lt;P&gt;I'm curious about that IteratePages behavior you saw though. Which .Net SDK version are you using? I know there was a bug in the implementation of that one a couple of releases ago that accidentally made it strict. But it's supposed to be lazy in the latest release.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Mar 2019 08:01:04 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2019-03-01T08:01:04Z</dc:date>
    <item>
      <title>.NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1548822#M10061</link>
      <description>&lt;P&gt;Good day everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I am trying to do something I'd consider simple and straight-forward and, yet, I'm failing over and over again. It seems to me I'm missing some basic understanding around Hyper Cubes and how Qlik manages and serves this kind of object.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; The ask is simple: to print all the contents in a Table defined by a HyperCube. Below is my .NET/C# code with comments where the problem's been raised:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;public int&lt;/FONT&gt; PrintTableFromHypercube(&lt;FONT color="#0000FF"&gt;string&lt;/FONT&gt;[] dims, &lt;FONT color="#0000FF"&gt;int&lt;/FONT&gt; max_rows) {
    &lt;FONT color="#0000FF"&gt;try&lt;/FONT&gt; {
        &lt;FONT color="#339966"&gt;// Defines the Hypercube objects&lt;/FONT&gt; 
        QE.&lt;FONT color="#008080"&gt;HyperCubeDef&lt;/FONT&gt; hyper_cube = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; QE.&lt;FONT color="#008080"&gt;HyperCubeDef&lt;/FONT&gt;();
        &lt;FONT color="#008080"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color="#008080"&gt;HyperCubeDimensionDef&lt;/FONT&gt;&amp;gt; dim_defs = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color="#008080"&gt;HyperCubeDimensionDef&lt;/FONT&gt;&amp;gt;();
        &lt;FONT color="#008080"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color="#008080"&gt;HyperCubeMeasureDef&lt;/FONT&gt;&amp;gt; measure_defs = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;List&lt;/FONT&gt;&amp;lt;&lt;FONT color="#008080"&gt;HyperCubeMeasureDef&lt;/FONT&gt;&amp;gt;();

        dim_defs.Add(&lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;HyperCubeDimensionDef&lt;/FONT&gt; { Def = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;HyperCubeDimensionqDef&lt;/FONT&gt; { FieldDefs = dims } });
        measure_defs.Add(&lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;HyperCubeMeasureDef&lt;/FONT&gt; { Def = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; &lt;FONT color="#008080"&gt;HyperCubeMeasureqDef&lt;/FONT&gt; { Def =&lt;FONT color="#993300"&gt; "1"&lt;/FONT&gt; } });
                
        hyper_cube.Dimensions = dim_defs;
        hyper_cube.Measures = measure_defs;

        QE.&lt;FONT color="#008080"&gt;GenericObjectProperties&lt;/FONT&gt; generic_prop = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; QE.&lt;FONT color="#008080"&gt;GenericObjectProperties&lt;/FONT&gt;();
        generic_prop.Info = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; QE.&lt;FONT color="#008080"&gt;NxInfo&lt;/FONT&gt;();
        generic_prop.Info.Type = &lt;FONT color="#993300"&gt;"hypercube"&lt;/FONT&gt;;
        generic_prop.Set&amp;lt;QE.&lt;FONT color="#008080"&gt;HyperCubeDef&lt;/FONT&gt;&amp;gt;(&lt;FONT color="#993300"&gt;"qHyperCubeDef"&lt;/FONT&gt;, hyper_cube);

&lt;FONT color="#339966"&gt;        // Creates the Hypercube on the actual Application&lt;/FONT&gt;
        QE.&lt;FONT color="#008080"&gt;GenericObject&lt;/FONT&gt; obj = QlikApp.CreateGenericSessionObject(generic_prop);

        &lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; pager = &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt; QE.&lt;FONT color="#008080"&gt;NxPage&lt;/FONT&gt; { Top = 0, Left = 0, Width = dims.Length, Height = max_rows };

        &lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; qlik_data = obj.GetHyperCubeData(&lt;FONT color="#993300"&gt;"/qHyperCubeDef"&lt;/FONT&gt;, &lt;FONT color="#0000FF"&gt;new&lt;/FONT&gt;[] { pager });
        &lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; hyper_cube_pager = obj.GetHyperCubePager(&lt;FONT color="#993300"&gt;"/qHyperCubeDef"&lt;/FONT&gt;);
        &lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; current_page = hyper_cube_pager.GetFirstPage();
        &lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; data_page = current_page.FirstOrDefault();

&lt;FONT color="#339966"&gt;        // Keeps reading data while the page is not empty.&lt;/FONT&gt;
        &lt;FONT color="#0000FF"&gt;while&lt;/FONT&gt; (data_page.Matrix.Count() &amp;gt; 0) {
&lt;FONT color="#339966"&gt;            // Reads each row from the current page of data.&lt;/FONT&gt;
            &lt;FONT color="#0000FF"&gt;foreach&lt;/FONT&gt; (&lt;FONT color="#0000FF"&gt;var&lt;/FONT&gt; row &lt;FONT color="#0000FF"&gt;in&lt;/FONT&gt; data_page.Matrix) {
&lt;FONT color="#339966"&gt;                /****************************************************
                    Here's where the problem is: No matter how many fields or measures
                    I add, my "row" object will always return a single NxCell. So, it seems&lt;BR /&gt;                    like I cannot traverse those values to print on the screen.
                    *****************************************************/&lt;/FONT&gt;
                &lt;FONT color="#008080"&gt;Debug&lt;/FONT&gt;.WriteLine(&lt;FONT color="#993300"&gt;$"Current row has '&lt;/FONT&gt;{row.Count}&lt;FONT color="#993300"&gt;' elements"&lt;/FONT&gt;);

                &lt;FONT color="#339966"&gt;// Reads each field in the current row&lt;/FONT&gt;
                &lt;FONT color="#0000FF"&gt;for&lt;/FONT&gt; (&lt;FONT color="#0000FF"&gt;int&lt;/FONT&gt; i=0; i&amp;lt; dims.Length; i++) {
                    &lt;FONT color="#008080"&gt;Debug&lt;/FONT&gt;.Write(&lt;FONT color="#993300"&gt;$"Field '&lt;/FONT&gt;{dims[i]}&lt;FONT color="#993300"&gt;': '&lt;/FONT&gt;{row.ElementAt(i).Text}&lt;FONT color="#993300"&gt;'\t"&lt;/FONT&gt;);
                }
                &lt;FONT color="#008080"&gt;Debug&lt;/FONT&gt;.Write(&lt;FONT color="#993300"&gt;"\n"&lt;/FONT&gt;);
            }

            &lt;FONT color="#339966"&gt;// Jumps to the next page of data from the pager&lt;/FONT&gt;
            data_page = hyper_cube_pager.GetNextPage().ToArray()[&lt;FONT color="#000000"&gt;0&lt;/FONT&gt;];
        }
        &lt;FONT color="#0000FF"&gt;return&lt;/FONT&gt; 0;
    } &lt;FONT color="#0000FF"&gt;catch&lt;/FONT&gt; {
        &lt;FONT color="#0000FF"&gt;return&lt;/FONT&gt; ~1;
    }
}&lt;/PRE&gt;&lt;P&gt;Thanks in advance for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 16:48:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1548822#M10061</guid>
      <dc:creator>Dan-Kenobi</dc:creator>
      <dc:date>2019-02-25T16:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1549107#M10063</link>
      <description>&lt;P&gt;That's a lot of code, and I haven't reviewed it in detail, but I see two things in that code that might not be what you want:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You create just a single hypercube dimension based on your input field. Such dimensions (with multiple fields) are typically used for stacked or cyclic dimensions. I get the feeling this is probably not what you want. I would assume that you probably want to do something like this instead:&lt;BR /&gt;
&lt;PRE&gt;var dim_defs = dims.Select(dim =&amp;gt; new HyperCubeDimensionDef { Def = new HyperCubeDimensionqDef { FieldDefs = new[] { dim } } }).ToList();&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;You use "Width = dims.Length" when you define your start page. That will mean that you will never consider the number of measures you add when you construct your page. I would recommend that you use the "NumberOfColumns" property from the pager object instead, like this:&lt;BR /&gt;
&lt;PRE&gt;var hyper_cube_pager = obj.GetHyperCubePager("/qHyperCubeDef");
var startPage = new NxPage { Top = 0, Left = 0, Width = hyper_cube_pager.NumberOfColumns, Height = max_rows };
var data_page = hyper_cube_pager.GetData(new []{startPage});;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;And finally I would recommend that you use the IteratePages method when you want to traverse the data like you are doing. With that construct you could write your code like this:&lt;/P&gt;
&lt;PRE&gt;foreach (var row in hyper_cube_pager.IteratePages(new[] { startPage }, Pager.Next).SelectMany(pages =&amp;gt; pages.First().Matrix))
{
	Debug.WriteLine($"Current row has '{row.Count}' elements");
	...
}&lt;/PRE&gt;
&lt;P&gt;And two references that might be of interest to you:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;On retrieveing data with the .Net SDK:&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2019/Subsystems/NetSDKAPI/Content/Sense_NetSDKAPI/HowTos/Net-Sdk-How-To-Retrieving-Data.htm" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/February2019/Subsystems/NetSDKAPI/Content/Sense_NetSDKAPI/HowTos/Net-Sdk-How-To-Retrieving-Data.htm&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;On use of hypercubes in the .Net SDK:&lt;BR /&gt;&lt;A href="https://github.com/kolsrud/qlik-dot-net-sdk-hypercube-usage" target="_blank" rel="noopener"&gt;https://github.com/kolsrud/qlik-dot-net-sdk-hypercube-usage&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 27 Feb 2019 07:26:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1549107#M10063</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-02-27T07:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550502#M10082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/41242"&gt;@Øystein_Kolsrud&lt;/a&gt;&amp;nbsp; , thank you so very much for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;In short, yes it did work. My fundamental understanding flaw was around the HyperCubeDimensionDef where I did one single dimension with multiple fields instead of adding multiple objects. So, THANK YOU for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;The second link you forwarded, for the GitHub project, has been really useful. So additional points for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;One thing I need to comment is around the IteratePages method. For medium sets of data (50K+) and plus, it was taking a lot of time to initialize. I'm guessing the LINQ code asked the server to do the paging before returning the first on. So I fell back to my original approach where I get each page sequentially.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;This was a great lesson and I really appreciate your help&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 13:24:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550502#M10082</guid>
      <dc:creator>Dan-Kenobi</dc:creator>
      <dc:date>2019-02-28T13:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550709#M10091</link>
      <description>&lt;P&gt;Good! I'm glad you were able to make progress!&lt;/P&gt;
&lt;P&gt;I'm curious about that IteratePages behavior you saw though. Which .Net SDK version are you using? I know there was a bug in the implementation of that one a couple of releases ago that accidentally made it strict. But it's supposed to be lazy in the latest release.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 08:01:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550709#M10091</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-03-01T08:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550784#M10092</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/41242"&gt;@Øystein_Kolsrud&lt;/a&gt;&amp;nbsp; - I am using QlikSense.NetSDK, version 13.3.1 from nuget.&lt;/P&gt;&lt;P&gt;I just saw the most recent one is 13.9.0, but I won't be able to update this before the next release. When I can, I will update and give the IteratePages another shot.&lt;/P&gt;&lt;P&gt;Thanks again for your help. I see more posts like this rising in the future and I'll start tagging you if that's ok.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 21:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550784#M10092</guid>
      <dc:creator>Dan-Kenobi</dc:creator>
      <dc:date>2019-02-28T21:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550948#M10095</link>
      <description>&lt;P&gt;OK, that would explain it. It seems the first version where that IteratePages behavior was fixes was in 13.8.0.&lt;/P&gt;
&lt;P&gt;Funny you should run into that issue right now. I was in Krakow for the Lambda Days conference just last week and gave a presentation where I actually mentioned that very bug in the context of leveraging functional design principles in an object oriented environment.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 08:00:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1550948#M10095</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-03-01T08:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1551033#M10096</link>
      <description>Do you happen to have a link for that presentation?</description>
      <pubDate>Fri, 01 Mar 2019 11:14:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1551033#M10096</guid>
      <dc:creator>Dan-Kenobi</dc:creator>
      <dc:date>2019-03-01T11:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1551246#M10099</link>
      <description>&lt;P&gt;It was this one:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lambdadays.org/lambdadays2019/oystein-kolsrud" target="_blank"&gt;http://www.lambdadays.org/lambdadays2019/oystein-kolsrud&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;They are currently in the process of uploading the presentations, but I'm not sure if mine will make it. There were some technical issues with the recording equipment when I did my talk, and I'm not sure if they were able to fix it in the end.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 18:14:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1551246#M10099</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-03-01T18:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: .NET To read Table Cells returned from a Hypercube</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1556942#M10180</link>
      <description>&lt;P&gt;Nice! It did make it! You'll find it here if you are interested:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://youtu.be/Wq32ZjEfZCI" target="_blank"&gt;https://youtu.be/Wq32ZjEfZCI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The part relating to the bug you saw starts here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://youtu.be/Wq32ZjEfZCI?t=1366" target="_blank"&gt;https://youtu.be/Wq32ZjEfZCI?t=1366&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;With the Qlik Sense specific part here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://youtu.be/Wq32ZjEfZCI?t=1614" target="_blank"&gt;https://youtu.be/Wq32ZjEfZCI?t=1614&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 07:21:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/NET-To-read-Table-Cells-returned-from-a-Hypercube/m-p/1556942#M10180</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2019-03-15T07:21:13Z</dc:date>
    </item>
  </channel>
</rss>

