Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Not applicable

Re: Scripting problem in relating columns in the same table.

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;

4 Replies
anbu1984
Not applicable

Re: Scripting problem in relating columns in the same table.

Can you provide expected output?

jagan
Not applicable

Re: Scripting problem in relating columns in the same table.

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

Re: Scripting problem in relating columns in the same table.

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
Not applicable

Re: Scripting problem in relating columns in the same table.

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;