Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

14 Replies
Anonymous
Not applicable
Author

Is this inside QS application or in java script?

I meant if you have any tutorials how to load specific dimensions items by name of the dimension inside java script.

Something like getDimension or getVariableById but that works

Anonymous
Not applicable
Author

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);

Anonymous
Not applicable
Author

Yes, that was what I want. Could I ask you what is qFrequencyMode: "V"? and qFieldDefs: ["DimB"] is a name of DimB or id of DimB? Did I need to add DimA and DimB as dimensions in Qlik Sense Applications to this extension widgets?

Thank you a lot.

Anonymous
Not applicable
Author

If you Google qlik sense createList this is the second hit

    createList method ‒ Qlik Sense Developers

Here it gives an example and link to ListObjectDef ‒ Qlik Sense Developers

How you need to exploit the createList method will depend on your precise needs.

[You'll get loads of other hits as well]

ErikWetterberg

Hi,

If you want to use this in an extension you need to put it in a qStringExpression. In an extension it would be something like this:

initialProperties:{

  fieldA:{

        qStringExpression: "=Concat(FieldA, ';')"

},

  fieldB: {

        qStringExpression: "=Concat(FieldB, ';')"

}

},

paint:function($element,layout){

//layout.fieldA will contain all values for fieldA,

//layout.fieldB will contain all values for fieldB

Second parameter is the delimiter, I've used ;, you should be able to use just about anything.

Not clear if you want the result to depend on the users selections or not, you might need to add some set analysis to avoid having your result change when the user makes selections.

You don't need to loop through the values and you don't need to handle the asynchronity problems, the framework will do that for you. If you want the extension to be snapshottable and printable, thats possible (might be irrelevant).

I haven't actually tested this code, so there might be syntax errors.

Hope this helps

Erik Wetterberg