Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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
thks a lot for your help