Skip to main content

Hello Community,

 

maybe I am just blind and didn’t find it yet in the documentation, but could it be that there isn’t any possibility to determine if there is a number in a specific pattern?

I’ve got a column “unit” which got values like ‘A123’ and ‘AB12’ - I need to filter out every unit which got no number on second position.

Like in regex, I can do: ^(.)\d to get if the second character of my string is a number.

SQL Patindex also can do very basic capturing groups like %[0-9]%  - which will give me 2 if the first number is on second place.

 

At the moment I am doing this with this PQL:

TO_INT(
SUBSTRING("TA_MR_PKC_EVENT"."BEARBEITENDE_ORGA",1,1)
)

Which results in NULL if the second position isn’t a number - I can work with that, I am totally fine about it -  but I am a little bit curious if there is an more elegant way in doing this.

 

Best regards,

Fabian

COLUMN_TYPE should exactly do this: https://docs.celonis.com/en/column_type.html

 


COLUMN_TYPE should exactly do this: https://docs.celonis.com/en/column_type.html

 

Hi Jan Peter,

thank you very much for your answer! But if I understand COLUMN_TYPE correctly, it only gives me the type of one column of the datamodell - which is always STRING in my use case.

I only want to check the Type of one segment of the String - here specifically the second position.


Hmm, good point, I was a bit too quick here. I expected that it used character recognition, but it seems indeed that it’s using the database’s datatype. 
In that case, I think you’ve found quite a good and clean workaround doing this!