How to write into data tables

Hi Everyone ,

can anyone please let me know how to write dynamic data to a data table .in a particular column

Im trying to write the data extracted from PDF to the data table ,

below is the error Im facing

Thanks!
Priya

You can write using : dataTable.Rows(IndexNumberOfRow).Item(ColumnName)

Hi Priya,

Can you please share the entire error details you are getting. If possible, share a sample workflow which will be helpful to give you a proper solution.

If the data in the PDF is tabular format, you can use screen scraping to identify the entire table and it will return you a datatable directly.
Otherwise, if the data in the PDF is not in tabular format, you can identify individual content and get the data and use string manipulation or RegEx to manipulate the data.

Regards,
Tuhin

1 Like

HI @Nihal_Bisen,

How to pass the index number for row ? I will pass the data to the rows dynamically .

SO if i give a string like dataTable.Rows(6).item(CMN) then it will always write in rows 6 of column right ?

You can use :

ForEach row in dataTable (Use ForEachRow activity)

 index = dataTable.Rows.IndexOf(row)
 cellVal = dataTable.Rows(index).item(CMN)
4 Likes

Yes you are correct Priya…You need to make dynamic IndexNumber variable so you can write data in coming rows.
I wonder if you can use a assign activity for increment of IndexNumber Variable
Example

  1. Put if block for Checking Index Number
  2. assign activity:
    IndexNumber = 0
  3. assign Activity:
    dataTable.Rows(IndexNumber).Item(CMN) = “StringVariable”
  4. Then Increase Index number for Next row using assign activiti:
    IndexNumber = IndexNumber + 1
  5. Come back to step 1

It will look like your below screenshot.
DataTable

2 Likes

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