Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Fellow users,
I have the following challenge. I have 3 fields BillCode, BillCodeNew and Result. I would like to create the following calculation:
If (BillCodeNew = Blank or has the Same Value as BillCode, then field Result should have the value of BillCode, else the field Result should have the value of BillCodeNew)
I tried to solve this with the following script:
=if(BillCodeNew =' ' or BillCodeNew = BillCode, BillCode,BillCodeNew) as Result
Greetings from Holland,
Aissam
Try this:
=If(IsNull(BillCodeNew),BillCode,BilCodeNew) AS Result
I don't know if it is necessary to include the prefix "JC."
Good luck!
Aissam,
Its really important to differentiate between 'blank', 'space' and null. A field may actually have a value of space and may be represented by ' ' (a space between single quotes) whereas null may be represented by '' (single quotes with nothing between. A space actually has a value of hex20 in ASCII and so is as much a character as 'a' or any other. Null on the otherhand is undefined - nothing at all.
Regards,
Gordon
I will try to give more information. I have two tables the first is
JC:
Load BillCode, job
from Excel
the second one is (in this table I only have jobs that should have the BillCodeNew)
Reallocation:
load BillCodeNew,job
From Excel1
The am doing the calculation in a pivot table.
Regards,
Aissam
Another thing to keep in mind regarding null values and different type of null values:
Well that explains a few things!! Although, it doesn't feel right to be treating my QlikView data as if it came out of DB2!
Aissam,
1. I use len(trim(BillCodeNew)) = 0 as a condition that covers all possible cases of "space" or null() or missing.
2. The second condition (BillCode=BillCodeNew) is redundant - if the two codes are the same, it doesn't matter which one do you use.
So, the final formula should be:
if(len(trim(BillCodeNew)) > 0, BillCodeNew, BillCode)
regards,
Oleg
Thanks jsn. you made my friday night a happy night.