<?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: easy way to check if dimension has values in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378720#M8174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;If you only want the code to run on load, can't you place the code inside the controller instead since the controller is only executed on load?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jesper&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Oct 2017 07:40:40 GMT</pubDate>
    <dc:creator>_jespers_</dc:creator>
    <dc:date>2017-10-31T07:40:40Z</dc:date>
    <item>
      <title>easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378719#M8173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15093774246565349 jive_text_macro" jivemacro_uid="_15093774246565349"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm revising a d3-based extension (Sankey) and I have a scenario in which I want to load several dimensions, but depending on the time in the year, several of these dimensions may have empty values. Specifically, I'll have dimensions like Q1, Q2, Q3, Q4 set up, but until its actually the 2nd quarter of the year (school year, actually), there won't be data there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I can check if there are any non-null values by doing something like this with the layout object in the paint function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1509377480149566 jive_text_macro" jivemacro_uid="_1509377480149566" modifiedtitle="true"&gt;
&lt;P&gt;var qData = layout.qHyperCube.qDataPages[0];&lt;/P&gt;
&lt;P&gt;var nDim = layout.qHyperCube.qDimensionInfo.length;&lt;/P&gt;
&lt;P&gt;var dimIsNull = [];&lt;/P&gt;
&lt;P&gt;for (var d = 0; d &amp;lt; nDim; d++){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var allNull = true;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var r = 0; r &amp;lt; qData.qMatrix.length; r++){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (qData.qMatrix&lt;R&gt;&lt;D&gt;.qElemNumber &amp;gt;= 0){ // or I might check for a specific text like [.qText != "-"]&lt;/D&gt;&lt;/R&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allNull = false;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dimIsNull&lt;D&gt; = allNull;&lt;/D&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works, but it seems inefficient because I have to loop through the entire HyperCube on every paint call. Really, I would only need to call this function once on load. Also, since I come from the R programming world iterating through this sort of matrix pains me deeply. Is there a more elegant way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2017 15:43:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378719#M8173</guid>
      <dc:creator>jonvitale</dc:creator>
      <dc:date>2017-10-30T15:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378720#M8174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;If you only want the code to run on load, can't you place the code inside the controller instead since the controller is only executed on load?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jesper&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 07:40:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378720#M8174</guid>
      <dc:creator>_jespers_</dc:creator>
      <dc:date>2017-10-31T07:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378721#M8175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There is some info on diemnsions in the dimensionInfo array: &lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/June2017/Subsystems/EngineAPI/Content/Structs/NxDimensionInfo.htm" title="https://help.qlik.com/en-US/sense-developer/June2017/Subsystems/EngineAPI/Content/Structs/NxDimensionInfo.htm"&gt;https://help.qlik.com/en-US/sense-developer/June2017/Subsystems/EngineAPI/Content/Structs/NxDimensionInfo.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is qCardinal what you are after? Use the dubugger to explore what is in the structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing this just on load seems not a good idea... What if the user makes a selection that excludes Q2, Q3, Q4? Or if he already has made such a selection when the extension first loads and then clears it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erik Wetterberg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 09:22:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378721#M8175</guid>
      <dc:creator>ErikWetterberg</dc:creator>
      <dc:date>2017-10-31T09:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378722#M8176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Erik mentions, it's probably a bad idea for me to put the code outside the paint function - unforeseen circumstances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, I am interested in what you mean by the "controller". I'm not using angular here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 13:10:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378722#M8176</guid>
      <dc:creator>jonvitale</dc:creator>
      <dc:date>2017-10-31T13:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378723#M8177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You've done it again Erik! There it is right in the hyperCube. Dimension index 3, qCardinal is 0.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" height="307" src="https://community.qlik.com/legacyfs/online/181621_Capture.PNG" style="height: 307.241px; width: 162px;" width="162" /&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 13:15:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378723#M8177</guid>
      <dc:creator>jonvitale</dc:creator>
      <dc:date>2017-10-31T13:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: easy way to check if dimension has values</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378724#M8178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I'm referring to the controller in angular. So if you don't use that you can ignore my previous answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 13:24:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/easy-way-to-check-if-dimension-has-values/m-p/1378724#M8178</guid>
      <dc:creator>_jespers_</dc:creator>
      <dc:date>2017-10-31T13:24:38Z</dc:date>
    </item>
  </channel>
</rss>

