Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
naveenchellaara
Contributor III
Contributor III

Script not assigning values to variables

Hi

I am using Qlikview 11.2. I have this following table

HeatMap_Rules_Key

Condition

MinValue

MaxValue

Color

1

Between

0

            25

Red

2

Between

25

            50

Blue

3

Between

50

100

Green

4

Between

100

125

Orange

The table will have only four rows and i need to take each condition into a variable.

I have created four variables Condition1,Condition2,Condition3,Condition4.

I am using the following script

SQL SELECT Color = 255,

    Condition As Cond,

    "HeatMap_Rules_Key",

    "Max_Value" AS UL,

    "Min_Value" AS LL

FROM QlikView.dbo."HeatMap_Config";

LET Condition1 = FieldValue('Cond',1);

LET Condition2 = FieldValue('Cond',2);

LET Condition3 = FieldValue('Cond',3);

LET Condition4 = FieldValue('Cond',4);

The result when using the table above is

Condition1 = Between

Condition2 =

Condition3 =

Condition4 =

When i execute the script only the first variable is assigned the value('Between') and the other variable are NULL;

If i have a different string(i.e. other than 'between' as in the table below) all the variables are getting their values assigned.

HeatMap_Rules_Key

Condition

MinValue

MaxValue

Color

1

Between

0

            25

Red

2

one

25

            50

Blue

3

two

50

100

Green

4

three

100

125

Orange

The result when using this table is

Condition1 = Between

Condition2 = one

Condition3 = two

Condition4 = three

Can anyone help me with this?

1 Solution

Accepted Solutions
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Use "PEEK" instead of "FieldValue"....Field Value wont consider the Duplicate records..

LET Condition1 = Peek('Cond',0,'Table');

LET Condition2 = Peek('Cond',1,'Table');

LET Condition3 = Peek('Cond',2,'Table');

LET Condition4 =Peek('Cond',3,'Table');

View solution in original post

2 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Use "PEEK" instead of "FieldValue"....Field Value wont consider the Duplicate records..

LET Condition1 = Peek('Cond',0,'Table');

LET Condition2 = Peek('Cond',1,'Table');

LET Condition3 = Peek('Cond',2,'Table');

LET Condition4 =Peek('Cond',3,'Table');

naveenchellaara
Contributor III
Contributor III
Author

Thanks a lot for the quick and correct response.

I was having trouble with FieldValue and did not know other options.