Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scripting problem in relating columns in the same table.

Guys, I have the following table:

item_idFood_nameFood_PriceClassificationClassifications
1hamburguer10unhealthy
2ice cream11unhealthy
3steak12unhealthy
4bread13healthy
5coke14unhealthy
6juice1healthy
7green salad2healthy
8mango3healthy
9ham15healthy
10cesar salad16unhealthy
11chicken8healthy
12fish8healthy
13tofu5healthy
Ajuice0.5healthycoke
Bgreen salad1.5healthycesar salad
Cmango2.5healthyice cream
Dchicken7healthyhamburguer
Efish7healthyhamburguer
Ftofu4healthyhamburguer
Gfish10healthyhamburguer

I would like a script that everytime that it sees in the Classifications column a name, that they look for this name in the column "Food_name" (same table), and return it that "Food_name" item_id and Food_Price.

How do we do that?

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Table:

Load * Inline [

item_id,Food_name,Food_Price,Classification,Classifications

1,hamburguer,10,unhealthy,

2,ice cream,11,unhealthy,

3,steak,12,unhealthy,

4,bread,13,healthy,

5,coke,14,unhealthy,

6,juice,1,healthy,

7,green salad,2,healthy,

8,mango,3,healthy,

9,ham,15,healthy,

10,cesar salad,16,unhealthy,

11,chicken,8,healthy,

12,fish,8,healthy,

13,tofu,5,healthy,

A,juice,0.5,healthy,coke

B,green salad,1.5,healthy,cesar salad

C,mango,2.5,healthy,ice cream

D,chicken,7,healthy,hamburguer

E,fish,7,healthy,hamburguer

F,tofu,4,healthy,hamburguer

G,fish,10,healthy,hamburguer ];

Left Join(Table)

Temp:

Load item_id as item_id1,Food_name As Classifications,Food_Price as Food_Price1 Resident Table;

View solution in original post

4 Replies
anbu1984
Master III
Master III

Can you provide expected output?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Load this table in dashboard and provide Classifications as list box and and create a Table box with all the columns.  If you select any classification then the data is automatically filtered and only corresponding values are displayed in Table box.

If this is not your expected, then come up with an example of what you want.

Regards,

Jagan.

Not applicable
Author

I would like to have this output:

item_idFood_nameFood_PriceClassificationClassificationsitem_id1Food_name1
1hamburguer10unhealthy
2ice cream11unhealthy
3steak12unhealthy
4bread13healthy
5coke14unhealthy
6juice1healthy
7green salad2healthy
8mango3healthy
9ham15healthy
10cesar salad16unhealthy
11chicken8healthy
12fish8healthy
13tofu5healthy
Ajuice0.5healthycoke514
Bgreen salad1.5healthycesar salad1016
Cmango2.5healthyice cream211
Dchicken7healthyhamburguer110
Efish7healthyhamburguer110
Ftofu4healthyhamburguer110
Gfish10healthyhamburguer110

I want the script to provide me the last two columns... How do I script that?

anbu1984
Master III
Master III

Table:

Load * Inline [

item_id,Food_name,Food_Price,Classification,Classifications

1,hamburguer,10,unhealthy,

2,ice cream,11,unhealthy,

3,steak,12,unhealthy,

4,bread,13,healthy,

5,coke,14,unhealthy,

6,juice,1,healthy,

7,green salad,2,healthy,

8,mango,3,healthy,

9,ham,15,healthy,

10,cesar salad,16,unhealthy,

11,chicken,8,healthy,

12,fish,8,healthy,

13,tofu,5,healthy,

A,juice,0.5,healthy,coke

B,green salad,1.5,healthy,cesar salad

C,mango,2.5,healthy,ice cream

D,chicken,7,healthy,hamburguer

E,fish,7,healthy,hamburguer

F,tofu,4,healthy,hamburguer

G,fish,10,healthy,hamburguer ];

Left Join(Table)

Temp:

Load item_id as item_id1,Food_name As Classifications,Food_Price as Food_Price1 Resident Table;