Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
upaliwije
Contributor 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
amarbogam
Contributor

Re: script

try using nested if statements for each condition.

Employee
Employee

Re: script

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
Valued Contributor II

Re: script

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

if(len(CL_CBAL)=0  

or

if(IsNull(CL_CBAL), ...

Re: script

What's your data?

What's your desired result?

Re: script

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

bhagirath
Contributor III

Re: script

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

Community Browser