Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
zadravecm
New Contributor III

Load dimensions separately in qMatrix

Hi,

I am working on extension, and I would like to load some data in it.

The Qlik way by adding dimensions is super, and easy to do.

However, there is some problems also.

Let say I need two dimensions inside (that are not related to each other), for example dimension A and B.

Let say dimension A has 200 items, and B has 300 items.

My qMatrix will then have 60.000 rows, (200x300) because they are not related, so it will create n x m matrix out of it.

But I wish to have only 500 rows.

Is there a way, to tell qlik sense application, to give me those dimensions separately and not to make matrix out of it?

Thank you

Marko Zadravec

1 Solution

Accepted Solutions

Re: Load dimensions separately in qMatrix

In javascript :


Try a couple of CallBack's something like this

function getDimAData(reply, app) {

          /* Add code here to populate a json array with DimA values */

  }

});

}

function getDimBData(reply, app) {

          /* Add code here add the DimB values onto your json array */

  }

});

}

That respectively call createList to create their cubes

app.createList({

        qDef: {qFieldDefs: ["DimA"]}, qFrequencyMode: "V", qInitialDataFetch: [{qHeight: 1000,qWidth: 1}]

    }, getDimAData);

app.createList({

        qDef: {qFieldDefs: ["DimB"]}, qFrequencyMode: "V", qInitialDataFetch: [{qHeight: 1000,qWidth: 1}]

    }, getDimBData);

View solution in original post

14 Replies
ErikWetterberg
Honored Contributor

Re: Load dimensions separately in qMatrix

Hi Marko,

You could use a calculated dimension that concatenates the two dimensions into one. Check this thread for a solution:

Combining values from multiple dimensions in one axis

Or you could concatenate in the script and make a new dimension.

Erik Wetterberg

Please mark as Helpful if you find this helps you.

zadravecm
New Contributor III

Re: Load dimensions separately in qMatrix

Hi,

Thank you for the answer, but I think this will not help me, because the dimensions are not connected with each other.

Maybe, there is an API, that return filters object (witch are in fact one dimension array). Then I could call this API for A and for B, and then I would convert problem from A x B to A + B... Do you know for any kind of this API?

ErikWetterberg
Honored Contributor

Re: Load dimensions separately in qMatrix

Well you could use two hyercubes or two listobjects in your extension. In that case you should probably add them to initialProperties. A problem with this is that the standard property panel does not really support multiple hypercubes, so setting it up might be complicated.

Erik Wetterberg

Re: Load dimensions separately in qMatrix

But extensions themselves do support multiple hypercubes.

So in the Properties Panel you just need to allow the names of Dim A & B to be defined.  Then in the javascript create 2 hypercubes for the 2 Dim's and concatenate the Dim vales they contain into a single json array

ErikWetterberg
Honored Contributor

Re: Load dimensions separately in qMatrix

Yes, that's possible, but then you can't configure other properties for the hypercubes, you might have problems with using Sense Dimensions and/or fields, which the standard property panel solves for you.

Not really knowing the use case,a solution might be to use a standard hypercube for one dimension, and a text field for the other.

Erik Wetterberg

Re: Load dimensions separately in qMatrix

Yup - You are correct it all depends on the what if's and the precise use case.

It may be that defining a new field of [Dim A+B] in the qvf load script could be the best way to go.

But as you say, whilst not really knowing the use case it is hard to say.

Re: Load dimensions separately in qMatrix

Just had a thought... if it is super easy to do it in QlikView then maybe posting a sample qvw with it working could help understanding.

I no longer use View so with only the unlicensed Personal Edition of View I would not be able to open it, but I expect others would have a licenced QlikView.

zadravecm
New Contributor III

Re: Load dimensions separately in qMatrix

Hi

Thank you for your discussion.

I understand that it all depend on case.

I just need the names of dimensions items, so I can build json file to POST a REST api.

The two hyperCube would be super, but I don't know how to call (get dimension) inside JS.

Could you post some example how to get the dimensions Items from name inside JS.

Marko Zadravec

ErikWetterberg
Honored Contributor

Re: Load dimensions separately in qMatrix

Hi,

Concat(distinct FieldName) will give you all values in a field. Might be useful with a delimiter also.

Erik Wetterberg