Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Highlighted
Not applicable

Combine fields in all possible ways

Hi guys, I'm new to QlikView and I've encountered some difficulties. I have my tables and I have a variable (let's call in var3) that gets updated based on other 2 variables(var1 and var2). These two, var1 and var2 (these variables are numbers), get their values after two selections from two fields(let  and var3 is simply the multiplication of these two variables ( var1 and var2).

What I am trying to do is to create a list, a table, whatever, with all the possible values for var3. (this actually means that I need some kind of script that would take all the possibilities of choices from f1 and f2 and calculate var3 and then save all the possible values of var3 in a table/list/whatever.

Thank you, I hope I explained myself well.

PS: I have the free version, so it would be great if you could explain me by writing for I cannot open files created by other users.

2 Replies
MVP & Luminary
MVP & Luminary

Re: Combine fields in all possible ways

Please don't create more than one discussion for the same question: Create table with all possible values of a variable


talk is cheap, supply exceeds demand
gopalopsharma
Contributor

Re: Combine fields in all possible ways

Hello Adrian,

What you need is an outer join of distinct values of Var1 and Var2..

Follow the steps below:

1. Write the code as below-

Comb_table:

Load distinct Var1, 1 as flag

  resident Table1;
Outer Join (Comb_table);

Load distinct Var2, 1 as flag

resident Table2;

2. Now your table Comb_table will have all the combinations of var1 and var2, Create a III field from this table like thebelow:

Load * , Var1*Var2 as Var3

resident Comb_table;

Hope this helps!!