Get value for particular row in datatable

Is there a way to get a value in one particular row in a datatable without using Get Row Item inside the For Each Row activity? In other words, how can I get the value in the first row under the table column headings in column 11?

Thanks,
Laura

2 Likes

Hi @lhendrix,

If you know the row number you can specify like this:
dt_Test.Rows(<row number>).Item("<Column Name>").ToString

Regards,
PD

4 Likes

Hi @lhendrix

Yes, as you mention without being for each row or for each loop,
you can even get with assign activity, the exact value of cell of a datarow in a datatable…like this
assign activity(for datatable named out_dt), for first row and 11th column

out_value = out_dt.Rows(0)(10).ToString

the reason for 0 and 10 instead of 1 and 11 is the rows and columns are usually taken with 0 index.

or if you know the name of the column, well and good you can mention as string like

out_value = out_dt.Rows(0)(“column_name”).ToString

Hope this would help you

Cheers…

11 Likes

@lhendrix

You can get it two ways either using column name or column index.

row(“ColumnName”).Tostring

row.Item(10).Tostring

Please let me know if you face any issue.

1 Like

Hi lakshman…

can you help me on this…?
----------https://forum.uipath.com/t/how-to-get-text-from-excel-column-and-paste-into-word-doc-line-by-line/166024?u=psujatha

TIA:slightly_smiling_face:

Hi,

I have two sheets. One is emp and second is comp

Emp sheet

Emp Name Age Salary Company Code
Swapnali 23 10000 1
Rajashree 25 25630 4
Rajiv 25 45000 5
Munish 28 20000 9

Comp sheet
Company Code Name
5 Tech Mahindra
9 Wipro
4 Infosys
1 KPIT

I have two flowcharts
one is flow1 and second is flow2 and I want to invoke that flowcharts in the main flowchart.

In the flow 1
firstly. I want to find out 4 company code in emp sheet and then
in the flow 2
I want to the company name of that company code which I found in the flow 1 (which is 4 company code)

Pls help

Hi
did we try lookup datatable activity
that is
—once after getting the datatable from read range for first excel named dt1 and for second excel with read range and get the datatable named dt2
–then use For each row loop and pass the variable dt1 as input
—inside the loop use first LOOKUP DATATABLE activity and mention these in property panel
Input - row(“Company Code”).ToString
Datatable —dt2
Lookup column name - “Company Code”
Target column name - “Name”
Out result - found value in a a string variable named str_output

Cheers @Swapnali_Londhe

Hi palan,

Can i know how to d it by using filter data table?

I did the following steps
Read both the sheets and assigned varibales as dt1 and dt2
Then filter data table- filter rows-keep company code = 2
Filter column keep company code

Now after this i want to drag lookup data table. But in lookup properties in input look up value tab - i want the value which i kept through filter data table(which is company code 2). Ap for that what i have to do.

But i don’t want to keep it manually. I want to store that filter output in one varibale and then use it in lookup data table

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