anyone could know why I have error here and how to solve it despite I already used it in another flow
Hi @omar_ismail
Your input variable must be string
Give like this
System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“(\W)”)
@omar_ismail Your AccounNumber variable is Int please change it to String
Hi @omar_ismail
DTPhotos is the integer make it string variable type.
Then you can use the below expression
System.Text.RegularExpressions.Regex.Matches(DTPhotos.ToString,“(Account\s\d)”)
Hope you understand!!
Regex.Match only returns one value. You’re trying to access the index (2) from something that isn’t an array. If you want an array of matches, use Regex.Matches, not Regex.Match.
Also, you can’t provide a datatable to Match nor Matches (DTPhotos). Regex doesn’t look in datatables, it looks in strings. You have to provide a string.
If you’re trying to find a value in a datatable, use the Lookup Data Table activity.
In match activity the first input variable type should be string…I guess you are trying to provide a datatable
Cheers
You can’t pass a datatable (DTPhotos) to Regex.Matches. You pass it a string.
If you’re trying to find a value in a datatable, use the Lookup Data Table activity.
And you can’t put .ToString on the end of Matches - it returns an array.
@omar_ismail
Don’t give data table variable, give only string variable
i have a column that contain photos path and i need to get it a part of the path in the next cell
Then first if you have multiple rows then use for each row in datatable and pass the datatable then and use currentRow("ColumnName").ToString
in the match activity
Column name is the value of the column name that is to be searched …and then can assign to currentRow("NewColumnname")
Cheers
i have a photo path and i need to get part of this path in a varible this part is acount 1, acount 2, or acount 3
i didn’t get your point sorry
Dtphotos is a datatable right…and you have a column containing some info from
Which you want to extract some data and move to another column…
For that follow the steps
- For each row in datattable dtphotos
2 inside use assign withcurrentRow("NewColumn") = System.Text.RegularExpressions.Regex.Matches(currentRow("ColumnName").ToString,"(Account\s\d)").Value
ColumnName - the column in which you have the data
NewColumn - column Name to which the data is to be moved
Cheers
@omar_ismail
You have taken the datatable to extract the output it is impossible. If you have column in the datatable, in that column you have the data in the rows. For taking the each row of that column use the for each row in datatable activity to iterate all rows in that column.
Create a String variable like Strvar.
Use the assign activity inside the for each row in datatable.
In assign activity give like this Strvar = Currentrow(“Columnname”).toString
The Strvar holds the row data. Then take another assign activity to write the regular expression.
Use the below regular expression for this
System.Text.RegularExpressions.Regex.Matches(Strvar.ToString,“(Account\s\d+)”)
Hope you understand!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.