Discussion board where members can get started with QlikView.
I have two fields .
Deviation after sounding and Difference vs Log survey:
I want to write a code that if the difference between them is less than 2 then a new column will display yes against the value or else no.
if (Deviation after sounding) - (Difference vs Log survey) <=2 then (NEW COLUMN ) = "Correction done"
or else "Correction Not Done"
if(rangesum([Deviation after sounding],-[Difference vs Log survey])<=2,'Correction done','Correction not done') as NewField
Did you try like:
LOAD field1, field2,
if ((Deviation after sounding - Difference vs Log survey) <=2, "Correction done", "Correction Not Done") AS NewFieldName
I have not done it in the table as the two fields are coming from different tables
Why do we need rangesum? Can I do it in the edit expression of chart properties(as I am using a standard table chart)
You need rangesum if either of the two fields can ever be null. F1-F2 will yield null if either is null.
Yes, you can do it in a chart expression. Generally it is better (faster) to do as many calculation is script as is feasible.
Hi I tried with the following code:
if(rangesum(SoundingCorrections.DEVIATION_AFTER_SOUNDING,-[Summary.Difference Log vs Survey])>= 0,'Correction done','Correction not done')
DEVIATION AFTER SOUNDING HAS THE FOLLWOING VALUES. = -42, -42, -42, -42
Difference Log vs Survey HAS THE FOLLWOING VALUES = 0, -42.68, -16, -7.89
But for all the values they are showing 'Correction Not Done' Which should not be true as the second value is clearly greater than 0
Add an expression:
rangesum(SoundingCorrections.DEVIATION_AFTER_SOUNDING,-[Summary.Difference Log vs Survey])
so you can see the values.
Can you share the qvw?
Can you share your data model and the script you are trying?
Can you share the data and script?