Get row number in datatable

Hi all,

here is a low level question. I am sure that this has already been answered, unfortunately I do not find it …

I want to search for a value (PurRqs) in the column “MRP elemnt” and output the value (0010044128/00010) from the next column (MRP element data) as a variable. I’ve created a datatable for this. My idea is to get the row number of “PurRqs” and then a query with row number & column number? Or are there better options?

Thanks for your help
Ottmar

Hi @Ottmar_Jobs,

You can directly retrieve the row which has PurRqs in MRP Element Column and use the Column Name or Index to access the Value in the corresponding MRP Element Data Column like below.

  1. Read the Datatable and store it in a variable, for instance, dtT
  2. Use the Select Method of Datatable to get the rows where MRP elemnt = ‘PurRqs’

MRP_Value = dtT.Select("[MRP elemnt] = 'PurRqs'")(0).Item("MRP element data").ToString

Warm Regards,
Ranjith Udayakumar

Hi Ranjith,

i get following message:

Assign: Syntax error: Missing operand after ‘elemnt’ operator.

What am i doing wrong?

Cheers
Ottmar

I got it! You have to set “mrp elemnt” in brackets:

ExtractDataTable.Select(“[mrp elemnt] = ‘PurRqs’”)(0).Item(“MRP element data”).ToString

Thanks anyway for your quick help! I’m sending red roses to Chennai… :slight_smile:

Ottmar

1 Like

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