January 4, 2019, 9:09am
Happy new year for everyone,
I have a question regarding an if statement.
How i can use a statement where im using data tables as the condition.
Because it can’t use data table type in boolean.
For example i want to use this statement that im using in for each (example below)
DTtes.Select(“Convert([text], ‘System.String’) not like ‘%tes1%’ and Convert([text], ‘System.String’) not like ‘%tes2%’ and Convert([Assignment], ‘System.String’) not like ‘%tes3%’”)
and write that statement in if statement.
I’m really stuck as of now.
Really need some help for this issue.
Thank you and will be waiting for your kind suggestion
Are the text and Assignment, column names in the data table?
The datatable.select function not returns boolean. So you cannot use the expression like that.
datatable.select will return an
array of data rows.
For example: DTtes.Select(“Column1=‘test1’”) , will return the array of data rows where Column1 has a value test1.
Are you trying to compare the value against all the data rows?
January 4, 2019, 9:47am
Yeah im trying to get the value that exclude the test1,test2 and others in column names.
basically im using that expression in for each row activity but since when im running the bot while the excel is not have that data (test1,test2,test3) it will return an error the source contains no data row.
Thats why im gonna using if activity so the error can be avoided.
Or there is another option for this problem?
Thanks a lot for the feeback
Create a variable drFiltered (datatype: Array of DataRows)
drFiltered = DTtes.Select( “text not like ‘%test1%’ AND text not like ‘%test2%’ AND Assignment not like ‘%test3%’”)
Use if condition like below -
if drFiltered.Length > 0 Then
January 7, 2019, 6:12am
drFiltered.Length > 0
Thanks for the solution and its works like a charm.
January 10, 2019, 6:12am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.