# Formatted search - case statement

I am trying to do a formatted search that would set the GL account field on the sales order row based on the first 2 digits of the business partner card code.

SELECT CASE

WHEN $[ORDR.cardcode] like "01%" then '40100-01'

WHEN $[ORDR.cardcode] like "02%" then '40100-02'

WHEN $[ORDR.cardcode] like "03%" then '40100-03'

WHEN $[ORDR.cardcode] like "04%" then '40100-04'

WHEN $[ORDR.cardcode] like "05%" then '40100-05'

WHEN $[ORDR.cardcode] like "06%" then '40100-06'

WHEN $[ORDR.cardcode] like "07%" then '40100-07'

WHEN $[ORDR.cardcode] like "08%" then '40100-08'

WHEN $[ORDR.cardcode] like "09%" then '40100-09'

WHEN $[ORDR.cardcode] like "10%" then '40100-10'

WHEN $[ORDR.cardcode] like "13%" then '40100-13'

else '40100-00'

The above does not work. I am trying to do this and refresh when the itemcode changes or anything on the row level.

Any ideas on what might be wrong?

Thanks in advance for any help

##### Jimmy Michael replied

Here is an example :

SELECT CASE WHEN $[$38.18.0] = 'OPPN1' THEN ($[$38.U_Price.NUMBER]/1.1) WHEN $[$38.18.0] = 'OPPN2' THEN ($[$38.U_Price.NUMBER]/1.1) WHEN $[$38.18.0] = 'OPPN3' THEN ($[$38.U_Price.NUMBER]) WHEN $[$38.18.0] = 'OPPN4' THEN ($[$38.U_Price.NUMBER]) WHEN $[$38.18.0] = 'OPPN0' THEN ($[$38.U_Price.NUMBER]) END

I suggest to use

$[$item.column.number/curr/date/0]

instead of

$[ordr.cardcode]

I have a SAP pdf file related to FMS. Let me know if you need it.

Rgds,