How to write a condition for below details

The condition is The values should start with only (0,1,2,3) & Should be contains only 9 digits

image

Cheers

@Manju_Reddy_Kanughula Can you elaborate more what condition you are looking for.

The number( value) should start only with 0 or1 or2 or 3.
Should be only 9 digits

I assume you are using the read range to read the file right?

Then use a for each row in a Data Table activity to iterate through your file, if you want to reference your data using the column name then use the below method:

1.) On your read range activity make sure that the AddHeaders option is checked:

image

2.) Inside a for each row add an if activity with the below condition:

CurrentRow("ABC").ToString.Trim.StartsWith("0") Or CurrentRow("ABC").ToString.Trim.StartsWith("1") Or CurrentRow("ABC").ToString.Trim.StartsWith("2") Or
CurrentRow("ABC").ToString.Trim.StartsWith("3") AndAlso CurrentRow("ABC").Length = 9

3.) If you do not however want to use the column name as a reference for your data then uncheck the above-mentioned option then use the below condition within an if the activity

CurrentRow(1).ToString.Trim.StartsWith("0") Or CurrentrowItem(1).ToString.Trim.StartsWith("1") Or CurrentRow(1).ToString.Trim.StartsWith("2") Or
CurrentRow(1).ToString.Trim.StartsWith("3") AndAlso CurrentRowItem(1).Length = 9

The number one in “CurrentRow(1)” represents the column number or index, just count your column and insert the correct number

Hey

try below code

CurrentRow("ABC").ToString.StartsWith("0") or CurrentRow("ABC").ToString.StartsWith("1") or CurrentRow("ABC").ToString.StartsWith("2") or CurrentRow("ABC").ToString.StartsWith("3") And (CurrentRow("ABC").ToString.Trim.Length = 9)

Regards!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.