Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

acces variable in inline object

hello

here is my code

threshold:

LOAD * INLINE [

key, warningv, errorv

'test1', 6500, 7000

'test2', 3000, 4000

'test3', 2500, 2000

];

testtable:

inner join(threshold)

LOAD 'test1' as key,

     @1 as timetest1,

     @2 as s2,

     @3 as s3,

     @4 as s4,

       @2+@3+@4 as mysum,

     if (@2+@3+@4 < warningv ,'green', 'red' ) as availability

FROM

....

With warningv it does not work, how can I user variable in order to compare @2+@3+@4 with 6500 (value of warningv in test1 from threshold table)?

thks

valery

4 Replies
daveamz
Partner - Creator III
Partner - Creator III

Hello,

     Try something like:

threshold:

LOAD * INLINE [

key, warningv, errorv

'test1', 6500, 7000

'test2', 3000, 4000

'test3', 2500, 2000

];

testtable:

inner join(threshold)

LOAD 'test1' as key,

     @1 as timetest1,

     @2 as s2,

     @3 as s3,

     @4 as s4,

       @2+@3+@4 as mysum

     //if (@2+@3+@4 < warningv ,'green', 'red' ) as availability

FROM

....

threshold1:

LOAD

key,

warningv,

errorv,

timetest1,

s2,

s3,

s4,

mysum,

if(mysum<warning, 'green', 'red') as as availability

Resident threshold;

drop table threshold;

Regards,

David

Not applicable
Author

hello

thks for your response. I am new in QV. Why do you drop threshold?

moreover why don't you drop also testtable?

what's the goal of droping table? memory space?

thk

Valery

daveamz
Partner - Creator III
Partner - Creator III

Otherwise QV will try to link the tables by common keys and you will end up with synthetinc keys which you must avoid.

Also, you can comment the drop line to see what happens.Testing is one way of learning. 🙂

Good luck,

David

Not applicable
Author

thks a lot for your help