'My case statement is not returning the correct values
I'm new to SQL so this may be obvious, I'm trying to get a text value to separate two different locations for me, but the "case" function I'm using isn't returning the correct data. here's what it looks like.
case
when {purchaseorder.number} = "not null" and {purchaseorder.name} = 'Vendor A'
then 'Location 1'
else
'Location 2'
end
This is a transaction search looking at sales orders, but I need it to reference the POs associated with them. Maybe the problem is because I'm trying to pull data from "Purchase Order Fields..."
Solution 1:[1]
Instead of = "not null", you should say
case when ({purchaseorder.number} IS NOT NULL and {purchaseorder.name} = 'Vendor A') then 'Location 1' else 'Location 2' end
NULL is not a value, therefore it cannot equal = or not equal != anything. It is not the same as = "not null" which is a value.. This other stack overflow answer has a more detailed explanation.
A secondary problem appears that Netsuite might require you to wrap the conditions in parenthesis.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
