Hi - Can anyone help me with this saved search Cas...
# suiteanalytics
l
Hi - Can anyone help me with this saved search Case function. It was working until the last part was added. I need the last part to be if the account starts with '13' then 'CAPEX' but when the account is 2280 then look at the item expense account number and if it starts with 13 than Capex otherwise it is opex. CONCAT(CASE WHEN LPAD({account}, 5) IN ('2001 ','2011 ','2012 ','2013 ','2020 ','2030 ','2005 ','2005.','2010 ','2010A','2011A','2012A') THEN '' ELSE {account.number} END, (CASE WHEN LPAD({account}, 2) IN ('13') THEN ' CAPEX ' WHEN LPAD({account}, 5) IN ('2280') and (LPAD({item.custitem_expense_account_num}, 2) IN ('13') THEN ' CAPEX ' ELSE ' OPEX ' END
g
There are some parentheses issues.
Try something like the following:
CONCAT(
CASE
WHEN LPAD({account}, 5) IN ('2001 ','2011 ','2012 ','2013 ','2020 ','2030 ','2005 ','2005.','2010 ','2010A','2011A','2012A')
THEN '' ELSE {account.number}
END
,
CASE
WHEN LPAD({account}, 2) IN ('13')
THEN ' CAPEX '
WHEN LPAD({account}, 5) IN ('2280') AND LPAD({item.custitem_expense_account_num}, 2) IN ('13')
THEN ' CAPEX '
ELSE ' OPEX '
END
)
I haven’t tested it, but it should at least fix the parentheses issues.
t
Why don't you just add a field to the account record to define whether it is opex or capex and display that?
l
@George McMullen It did not give me the error but it did not give me the correct result. It is a start I will work on it - Thank you!
@Tristan Day Thank you for that suggestion. We actually do have the field already on the items so I might be able to get it to work that way - thank you !
👍 1