I need to get the correponding row values when i gave the input
cell value.But i got error .Can anyone help
Hi,
Can you send screenshot of the workflow?
can you send any example workflow for this
can you provide the sample data?
Try like this
dt.Select(“[Column-0] like '%”+searchStr.ToString+“%'”).FirstOrDefault()(“ColumnName”)
Hi
Welcome to uipath community
Hope these steps would help you resolve this
—use INPUT DIALOG BOX activity and get the input from user with a string variable named str_input
—now use a Excel application scope and pass the file path as input
—inside the scope use a READ RANGE ACTIVITY and get the output with a variable of type datatable named dt
—now use a FOR EACH ROW activity and pass the variable dt as input
—use a assign activity inside the loop like this
Counter = 0
Where counter is a variable of type int32 with default value as 0
—inside the loop use a WHILE loop with condition like this
counter < dt.Columns.Count
Inside this loop use a IF condition like this
dt.Rows(dt.Rows.IndexOf(row))(counter).ToString.Contains(str_input.ToString)
If true it will go to THEN part where we can use this WRITELINE activity
String.Join(“-“,row.ItemArray)
Then next to this writeline mention a BREAK activity inside the THEN part of if condition
Cheers @rpa_developer1
It works for 1st row only
No.it not working
ya.exactly
Ok.is this possible to do this work using data table.select() function instead of foreach activity
yah ofcourse
if we know at which column this would appear
if so the expression will be like this
str_output = String.Join(“_”,dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Contains(str_input.ToString)).First().ItemArray)
this will give only the first match
but if we have more than one then
dt= dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Contains(str_input.ToString)).copytodatatable()
now this dt will have only the rows with that column having that value we obtained from dialog box
any how now we will be in a position to pass this as input to FOR EACH activity like this
dt.Rows and change the type argument as System.Data.Datarow
–inside the loop use a WRITELINE activity and mention like this
String.Join(“_”,item.ItemArray)
Cheers @rpa_developer1
i am getting error when trying to fetch last two row.Here is my main workflow and data
Main.xaml (8.0 KB)
And also i need to get the ID when i gave Value as input.What can i do