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: 
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

1 Solution

Accepted Solutions
stephencredmond
Luminary Alumni
Luminary Alumni

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
stephencredmond
Luminary Alumni
Luminary Alumni

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

Not applicable
Author

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