302
Views
8
Comments
Solved
Checking a data type of a caracter
Application Type
Reactive
Service Studio Version
11.53.43 (Build 62091)

Hi Guys,

Does it exist any native function to allow to check a data of a specific caracter inside an alphanumeric content?

For example: A0007BC1050

I need to analyse each one of these caracters, in order to validate its type of data (if it is a number or a string). 

I can create a function to do this validation, but I want to know if exists any native way already, because I didn't find it.

Thanks

2021-01-04 08-13-48
Toto
 
MVP
Solution

Hi,


I think the only "native" way to check on Outsystems is using regex. Other way is building function to do this. 

2021-10-23 05-44-15
José Marcelo da Silveira

Hi Toto, 

I'm really going to need to create a function. 

Thanks

2023-01-26 16-03-24
Ana Agostinho

Hello José Marcelo da Silveira, 


Correct me if I understood it wrong, but you only need to check if a certain expression has only letters or has letters and numbers both at the same time, right? 

Is it enough for you to validate if a you have numbers on a certain expression and return a boolean according to it? If it is, you can use the following function: 

Basically, this function checks if you can convert the text you insert to an integer value (only numbers). 


On the following link you have the official documentation regarding this expression and some simple examples:

Best regards, 

Ana

2021-10-23 05-44-15
José Marcelo da Silveira

Hi Ana,

I need to do exactly as Kilian commented. 

Analyze character by character. 

A0007BC1050 (A=string, 0=number, 0=number, 0=number, 7=number, B=string, ..., ....)

Unfortunately there is no ready solution, but thanks for your reply.

2023-01-26 16-03-24
Ana Agostinho

Hi José, 

No problem at all, that's great to hear that you found your answer! 

 If you have any other questions, please don't hesitate to ask. 

Best regards, 

Ana

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi José,

If you want to check, character for character, whether it's a number or a letter, then there's no out-of-the-box solution for that. You'll need to use Substr to get each character, and then check whether it's in a certain range. If you want to just validate whether all characters are either numeric or letters, you can use a regular expression, like Toto wrote.

2021-10-23 05-44-15
José Marcelo da Silveira

Exactly Kilian, 

I'll need to create a function. 

Thanks. 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.