Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

script

Hi

I have written the following line in my load script

IF(CL_OBAL>0 and (CL_OBAL-CL_ADJUS)=0 AND CL_CBAL=0,-1)AS NOs

Though the script is nut I do not get the desired results(Nos as negative figure) Pls help me whether there is a better way of writing the code

6 Replies
Anonymous
Not applicable

try using nested if statements for each condition.

JonnyPoole
Employee
Employee

what are some sample values for CL_OBAL , CL_ADJ, and CL_CBAL ?

you might need to round to integers first...

IF(CL_OBAL>0 and  round(CL_OBAL)=round(CL_ADJUS) AND CL_CBAL=0,-1)AS NOs


or if there are 2 decimals


IF(CL_OBAL>0 and  round(CL_OBAL*100)=round(CL_ADJUS*100) AND CL_CBAL=0,-1)AS NOs


and check out:


Rounding Errors

danieloberbilli
Specialist II
Specialist II

Maybe your fields have Nulls instead of zeros. In this case try something like

if(len(CL_CBAL)=0  

or

if(IsNull(CL_CBAL), ...

robert_mika
Master III
Master III

What's your data?

What's your desired result?

avinashelite

can you please share your with sample data so that we can help you

Anonymous
Not applicable

This is more towards data quality so scripts need to be modified as per the requirements of data

it would be great if you can share the sample qvw for further help