Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible to perform function of variable in scripts to lessen the the use of creating variable.

Hello Everyone.

Need your help,

Is it possible to perform function of variable in scripts to lessen the the use of creating variable.?

7 Replies
sushil353
Master II
Master II

Hi Nupur,

What is your exact requirement.?

~Sushil

Jason_Michaelides
Luminary Alumni
Luminary Alumni

HI,

iI'm not sure what you're trying to do. Do you mean you want to create the variable in the script?

JAson

Not applicable
Author

Hii shushil,

I want to decrease the use of variables in my dashboards like ,

i am using variable for calculating expression, i want to perform this function during loading of the table in my dashboard

Like i have some fields in a table ,

table 1

Field1     Field2          Field3

A               20               10

B               30               20

C               40               30

D               50               40

My expression is calculated by variable as

sum({<field1={'A'},field2={$var1}>}field3)

where var1=Field2+100/20

I want to perform this function at load time.

Please help.

sushil353
Master II
Master II

Hi Nupur,

i did not get the logic of your condition var1=Field2+100/20 since this condition will always be false in the script..

anyways chek the code below .. hope you will get some idea to solve your issue.

source:

LOAD * Inline

[

Field1,Field2,Field3

A,20,10

B,30,20

C,40,30

D,50,40

A,60,50

];

table:

LOAD sum(Field3) as exp,

Field1,

Field2

Resident source

Where Field1='A'

and Field2=(Field2+100)/20;

DROP Table source;

Not applicable
Author

Hii Jason M,

Thanks for reply,

I want to perform calculation during loading of the table without using variable,

Jason_Michaelides
Luminary Alumni
Luminary Alumni

How do you know the value of $var1 when executing the script?

Not applicable
Author

Hii shushil,

Yes this is giving me some problem.