How Do I validate String combination entered in Input dialog

studio
variable

#1

e.g. entered data in Input dialog field is X123456
A: How I validate that the first Character is a Sring, the other Characters Int ? Should I use try Catch?
B: How do I check if the value enter exist in an Excel column A?

Thanks


#2

Hi @Giovany,
1.
Use Is Matches activity to check the string is in valid format or not using regular expression

Pattern : ([A-Za-z]{1}[0-9]{6})
Input give your input out put will return the Boolean value.

Use Read range to get the excel sheet data into datatable
From that datatable you can check using if condition
If datatableName.select("column1='"+stringVariable+"'").length>0
If return true value already exists in the column1.

Regards,
Arivu


#3

Hi Arivu,

Many thanks for your quick response. Much appreciated.
The first part of my challenge is solved,

On the second part :
datatableName.select(“column1=’”+stringVariable+"’").length>0
Mine looks like this
Dt1.Select(“Data registration=’”+InputData+"’").length>0
I get the below exception error message

                     EV registration has thrown an exception

                     Source: If

                    Message: Syntax error: Missing operand after 'registration' operator.

                    Exception Type: SyntaxErrorException

I have tried
Dt1.Select(“Data registration=’”+InputData.toString+"’").length>0
Also the same error
Do I miss " or should I use [ be cause space in naming?

Many thanks in advanced,
Giovany


#4

yes you need to use [] is column name with space

Dt1.Select("[Data registration]='"+InputData.toString+'"").length>0

Regards,
Arivu


#5

Many thanks, Works out awesome!!