Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Highlighted
Not applicable

lookup in macro

Hi

nobody wants to give away how to get a "lookup" equivalent function work in a macro?

I have a listbox where user makes a selection. The table behind has 2 columns. I need the value of the according second column of the selected value.

I can step through all items of the listbox and look for the selection. This will give me the index of the selected value in the first column.

Now I can not find a function that returns me all values from the second column in the table, it looks like only functions exist that give me subsets of the field and my found index of col1 is unusable.

Juerg

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Luminary
Luminary

lookup in macro

Hi Juerg,

If I have 2 columns, ID and Value, and I make a selection (or selections) on the ID column, then the Concat(Distinct Value, ',') function will give me a list of the associated values in the Value field.

Now, I can't call Concal from a Macro. But what I can do is create a variable, lets call it vValue, which has a value of :

=Concat(Distinct Value, ',')

The "=" causes the Variable to always calculate the value so, if I query the value of the variable then I can get the result - and you can easily query variable values in a Macro.

Does that do what you want?

Regards,

Stephen

View solution in original post

2 Replies
Highlighted
Luminary
Luminary

lookup in macro

Hi Juerg,

If I have 2 columns, ID and Value, and I make a selection (or selections) on the ID column, then the Concat(Distinct Value, ',') function will give me a list of the associated values in the Value field.

Now, I can't call Concal from a Macro. But what I can do is create a variable, lets call it vValue, which has a value of :

=Concat(Distinct Value, ',')

The "=" causes the Variable to always calculate the value so, if I query the value of the variable then I can get the result - and you can easily query variable values in a Macro.

Does that do what you want?

Regards,

Stephen

View solution in original post

Highlighted
Not applicable

lookup in macro

Thanks Stephen

a bit of a hassle but finally worked, used the split function to get the value list into an array in the macro

Jürg