Showing results for 
Search instead for 
Did you mean: 

Calc.View: How to check if a field contains character?

0 Kudos

Hi Experts!

I have to check if a field is numeric, i.e., if there is only numbers with no character.

The output field is called CFOP, using SAP HANA Calculation View type SQL Script, the WHERE condition below DOES not work:

WHERE "CFOP" not like '%[a-z]%'.

I either do not know how to achieve this using Graphical Calculation View.

Does anyone have an idea how to check if a field contains a character?

Thanks in advance!


Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi Leandro,

For SQL script you can use regular expressions, see like_regexpr LIKE_REGEXPR - SAP HANA SQL and System Views Reference - SAP Library

For graphical calculation view you can try matchregex(string,regex) but I'm not sure it will work.

If not work for you, you can always replace(replace(replace....'string','0',''),'1',''),'2','')..... removing all numeric digits and comparing result with '' empty string. If empty at end it was empty or all digits were numeric.

Regards, Fernando Da Rós