Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Engine API - Get linked field values from another field

Hi all,

firstly, I'm not sure whether my question is phrased in the best way.  I'll try to explain:

Let's say I have two fields in an App: Film and Actor.  I can create a Sense App, and add two tables.  The first lists the Films, the second lists the Actors.  I can click on a Film, and the data shown in the 'actors' table is reduced (showing only the actor in the selected Film).

I'm trying to replicate this functionality using the Engine API.

1 - Select a film. (a restriction is that the films will be listed in a drop down box, so a selection will only ever be one film anyway)

2 - Get the associated Actors and display them.

I'm doing the following (pseudo):

1 - Calling 'CreateSessionObject' (as a list object) and 'GetListObjectData' on the 'Film' field to get the Films.  This seems to do the job and I get back the list of Films.

2 - When the user selects a Film, I call 'selectListObject', passing in the qElemNumber of that item for the '/qListObjectDef' parameter value.

3 - I then call 'CreateSessionObject' (as a list object) and 'GetListObjectData' on the 'Actor' field to get the associated Actors.  I get all of them back... if I look for a qState value of 'S', I don't get any.

It's not working, so something's not 100%, but is the best way to do this kind of thing? Any comments or help would be much appreciated!  I'm not even sure if it's possible with the approach I've taken.

Thanks for looking

Shane.

Tags (2)
1 Solution

Accepted Solutions
erik_wetterberg
Valued Contributor III

Re: Engine API - Get linked field values from another field

Hi Shane,

The maximum number of cells you can get in one go is 10.000 (se this thread) - note that the limit is on cells, not rows, but in a listobject you would probably have a width of 1, so it would be the same thing.

You will find the number of rows in qSize.qcy so you probably dont need to call GetCardinal(). You can also find number of rows in different states in qStateCounts.

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
5 Replies
Not applicable

Re: Engine API - Get linked field values from another field

Anybody?

erik_wetterberg
Valued Contributor III

Re: Engine API - Get linked field values from another field

Hi Shane,

I guess you are working with the Engine api without using the Mashup API.

SelectListObjectValues should have 4 parameters:

The first should be a path that refers to the ListObject you have created in your GenericObject (there could be several, that's why it's needed). Value will be something like '/qListObjectDef' or something that ends with '/qListObjectDef''.

The second one should be an array of integers referring to the values you would want to select.

The third is a boolean, toggle.

The fourth is also a boolean, softlock.

If you make a selection in the 'Films' field, the values in the 'Actor' field will not be selected, so thats OK. I'm not a 100% about this, but I would expect values to be Optional(Actors in the film) or eXcluded (others).

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Engine API - Get linked field values from another field

Hi Erik,

I may have been getting an error when I was calling SelectListObjectValues (the handle was invalid).  Didn't notice it before.

I have a lot of 'actors' - seems the most you can return in a call to 'getFieldData' is 1000 (qHeight parameter)... am I right in saying that you have to make several calls (let's say you have 1001 items):

Do you have to do 2 calls:

call 1: qTop 0, qHeight: 1000

call 2: qTop, 1000, qHeight: 1

after calling GetCardinal to find out the total number?

Thanks for your help.

Shane.

erik_wetterberg
Valued Contributor III

Re: Engine API - Get linked field values from another field

Hi Shane,

The maximum number of cells you can get in one go is 10.000 (se this thread) - note that the limit is on cells, not rows, but in a listobject you would probably have a width of 1, so it would be the same thing.

You will find the number of rows in qSize.qcy so you probably dont need to call GetCardinal(). You can also find number of rows in different states in qStateCounts.

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Engine API - Get linked field values from another field

Thanks Erik.