How can we get row value based on other row value in uipath

Hi Team,

I have some doubt regarding the excel data table, I have the excel data table in below format, where I need to get row 3 value based on row 2 value.
if row 2 have “Family” then call the row 3 value.

please find the below excel screen shot for the same.

Stent ID
(mm)
Stent Length
(mm)
Max Stent ID
(mm)
Compliance Information Delivery System Platform1 Delivery System Platform2 Symbol (REF)
Product Product Product Product Product Family Family
2.0 8 3.5 01933-733-PKG RX DES SYM_REF-2

FamilyTable_2.xaml (9.7 KB)

1 Like

Hi @SDSurajDubey

Read the excel and store in dt1

Use an if condition

dt1.Rows(0).ItemArray.Contains(“Family”)

If this condition is true

Then in Then section

Use the assign activitiy to get row 3 value in array

arr1= dt1.Rows(1).ItemArray()

Regards

Nived N :robot:

Hi Nived,

The statement “dt.Rows(0).ItemArray.Contains(“Family”)” gives me compiler error.

Error is : ‘Rows’ is not a member of ‘System.Data.DataRow’

Attached .xaml file here with.
FamilyTable_2.xaml (9.7 KB)

Hi @SDSurajDubey

Kindly check whether the dt variable is datatable or datatrow

It should be datatable

@SDSurajDubey
it looks like the implementation is driving away from the intention / requirement

  • it looping over the rows
  • But in the condition it is always checking first row (lets ignore the validation issue so far)
  • within the then case it is always fetching the second row value

depending on what you need you can adopt

Option 1: Looping:

Option 2: Index calculation:

  • get the index form the row containing Familiy within the col values
  • grab next row, based on calculated index + 1

Also we would recommend to resepcify the requirement and define what is to grab (row, data column value(s)…

1 Like

Hi Peter,

Thanks for the response.
The file is run success fully. But I did not got the out out.

We got output link : System.Object.

Thanks,
Suraj Dubey
FamilyTable_2.xaml (10.2 KB)

check the write line in screeshot (yellow marked). We use String.Join(…

Hi Peter,

I used the same but still same out put.

I have created one more file in that i got the out put but in that out put family filter is not working.

Attached here for your reference
Test_family_2.xaml (9.0 KB)
.

Can you do following:

Sharing the sample data with us ( feel free to anonymize the condidential data)

Hi Peter,

It is working now.
But I got all the values instead of only family rows values.

Thanks,
Suraj Dubey

Hi Peter,

I am not able to attached excel sheet here.
:disappointed:

Please find below example of my excel sheet.

Max Stent ID
(mm)
Compliance Information Delivery System Platform1 Delivery System Platform2 Symbol (REF) Symbol (UBD) Symbol (LOT)
Product Product Product Family Family Family Family
3.5 01933-733-PKG RX DES SYM_REF-2 SYM_UBD-1 SYM_LOT-2

Max Stent Id (mm), Compliance Information etc are headers.

Thanks,
Suraj Dubey

Hi Team,

Any input for this .

Thanks,
Suraj

Test_family_3.xaml (9.1 KB)
Hi Team,

I am able to print all the row values. But not specific value.

Please see the attached .xaml file. for the same.

Below is the example for my excel.

Stent ID
(mm)
Stent Length
(mm)
Max Stent ID
(mm)
Compliance Information Delivery System Platform1 Delivery System Platform2 Symbol (REF) Symbol (UBD) Symbol (LOT) Symbol (DOM) Product Description
Product Product Product Product Product Family Family Family Family Family Family
2.0 8 3.5 01933-733-PKG RX DES SYM_REF-2 SYM_UBD-1 SYM_LOT-2 SYM_DOM-4 ZOTAROLIMUS_ELUTING_CORONARY_STENT_SYSTEM
[Test_family_3.xaml attachment](upload://2vJvdgZL0cmoqaMk0bLDEmE2mPP.xaml) (9.3 KB)

@SDSurajDubey

Check below reference by calling the previous row with a condition

Link for Previous value to get

You can change that as per your requirement

Hope this will help you

Thanks

Hi Sri,

Its not working.

Thanks,
Suraj

FamilyTable_5.xaml (11.5 KB)
Hi Team,

Not able to get only Family below value. Based on my file I am able to take all the row value.
Help me to change my flow, So I can able to take below of the family row data.

Stent Length
(mm)
Max Stent ID
(mm)
Compliance Information Delivery System Platform1 Delivery System Platform2 Symbol (REF) Symbol (UBD) Symbol (LOT)
Product Product Product Product Family Family Family Family
8 3.5 01933-733-PKG RX DES SYM_REF-2 SYM_UBD-1 SYM_LOT-2

have a check if following do match your requirement.

Assumption:

  • first row - column names

  • second row - Product / Family label

  • read in excel into a datatable - with read range | ticked - AddHeaders - dtData

  • assign activity:
    LHS: arrFamilyIndexes | Int32( ) - an int Array
    RHS:

Enumerable.Range(0,dtData.Columns.Count).Where(Function (x) dtData.Rows(0)(x).toString.toUpper.Contains("FAMILY")).toArray

then retrieve the family values from third row by:
Assign Acitivity:
LHS: arrFamilyValues | String( ) - a string array
RHS:
arrFamilyIndexes.Select(Function (x) dtData.Rows(1)(x).toString).toarray

Hi Peter,

Thanks a lot. Its working.

Thanks,
Suraj Dubey
Get Value.xaml (7.1 KB)

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