I'm trying to add a CASE WHEN for Transaction type...
# administration
p
I'm trying to add a CASE WHEN for Transaction type, on a TRANS LINE ITEM formula, but nothing is recognised I've tried these
Copy code
CASE WHEN {transaction.type} = 'Sales Order'  
CASE WHEN {type} = 'Sales Order'
Any ideas?
g
need
=
between field and
Sales Order
p
@Gregory Jones Sorry, typo in my post. It did have the =
@Gregory Jones ah ha , seems to work with
Copy code
WHEN {baserecordtype} = 'workorder'  THEN
but not when I have a nested Case under that condition
s
if you want to have multiple cases as the same condition then the syntax is
CASE WHEN {type} = x OR {transaction.type} = x
p
I need to check the LINEITEM.SOURCE. That field only appears on the WorkOrder, not Sales Order. So I get an error on the SalesORder
@Sandii I have this:
Copy code
CASE  WHEN {baserecordtype} = 'salesorder'  THEN
 (CASE

	WHEN	{quantitybackordered} = 0     THEN  '<div style="color:black;background-color:#71DE28;padding:5px;text-align:center;">' || {quantitybackordered}
WHEN	{quantitybackordered} > 0 THEN	 '<div style="color:black;background-color:#F8450F;padding:5px;text-align:center;">' || {quantitybackordered}
ELSE ''

END)


WHEN {baserecordtype} = 'workorder'  THEN
 (CASE
	WHEN	{quantitybackordered} = 0     THEN  '<div style="color:black;background-color:#71DE28;padding:5px;text-align:center;">' || {quantitybackordered}
WHEN	{quantitybackordered} > 0 THEN	 '<div style="color:black;background-color:#F8450F;padding:5px;text-align:center;">' || {quantitybackordered}
WHEN    {itemsource} = 'Phantom'then 'Phantom'

ELSE ''
END)

ELSE 'NOTHING'

END
But on the Sales Order it errors saying it cannot find the ITEMSOURCE field - but it should'nt be looking for it as it is not in the case statement for 'salesorder'
{baserecordtype} = 'Sales Order' works, as when i have this, it works. Just seems to break when nested.
Copy code
CASE   WHEN {baserecordtype} = 'salesorder' THEN 'SALES ORDER'
 WHEN {baserecordtype} = 'workorder' THEN 'Work Order'
ELSE  'Not work order or SO'
End