Skip to main content

CASE WHEN SUBSTRING ( "VBAP"."MATNR", 0, 2 ) = '60' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 2 ) = '64' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '647731' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '664402' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '664403' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666161' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666162' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666931' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666986' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666987' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669181' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669182' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669183' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '669184' then 'Yes'

 WHEN SUBSTRING ( "VBAP"."MATNR", 0, 6 ) = '666651-001' then 'Yes'

ELSE 'No'

END

 

the first condition is not being applied, I see materials that starts with 60 o 64 with a no, I tested on the background and it is returning the value..

Hi Joyce,

 

If I got your problem correct, you want MATNR values that start with '60' or '64', and map them to 'yes', however the value 'no' is returned.

 

I think the problem lies in that you are trying to get the exact value '60' and '64', not that it starts with '60' or '64', you need to use the LIKE function instead of =

 

The code will look like follows. (pun not intended 😂 )

 

CASE WHEN "VBAP"."MATNR" LIKE '60%' THEN 'Yes'

   WHEN "VBAP"."MATNR" LIKE '64%' THEN 'Yes'

 

The % will act as a wildcard for any value that comes after '60' and '64' respectively.

 

Let me know if this resolved your problem or if you need more help 😊

 


Hi @joyce.cardo12,

 

If you always want to return 'Yes', the suggestion of @sverre.klein11 could be reduced by using the IN_LIKE operator (see IN_LIKE (celonis.com)).

 

Your statement will be:

 

CASE

WHEN "VBAP"."MATNR" IN_LIKE ( '60%' ,  '64%' , '647731%' ......) THEN 'Yes'

ELSE 'No'

END


Reply