Data Table column wise update in loop

Hi Team,

In loop I have an output which i have to update in column wise not row wise. In loop i will get 8 values which i have to update from A1 to A8. I have used Build data table and now all the values should update in single row but for each loop column should vary. like first time A2, then B2, then C2. Can you please let me know is this possible.

Thank you

Hi @sushma_jaladi can u share a screenshot of work flow

Hi,

image .
In the data table Out_Value should update in column wise.
First Out_value is Invoice Number.
Second Out_Value is Name and so on

Hi can show ur input datatable and output result u want like @sushma_jaladi

Hi,
This is input Data Table:

TESTCASE NAME FLAG Regular Expression Group Numbers
Validate Job Aid Check InvoiceNumber (?<=Invoice\sNumber)\s(#?)\s*(.*?(?=\s)) 1
Validate Job Aid Check Name (?<=Name\s)(.?(?=\s))\s(.?(?=\s)) 1
Validate Job Aid Check Email (?<=Email)\s*(.*?(?=\s)) 1
Validate Job Aid Check InvoiceDate (?<=Invoice\sDate)\s(.*?(?=\s)) 1
Validate Job Aid Check PhoneNumber (+\d{2}[ -]?)(?\d{1})?[ -]?\d{3}[ -]?\d{4} 1
Validate Job Aid Check DueDate (?<=Due\sDate)\s(.*?(?=\s)) 1
Validate Job Aid Check Address (?<=Address)\s*(.?(?=\s)\n.\n.\n.) 1
Validate Job Aid Check TotalAddress (?<=Total\sAmount)\s\d* 1

Output table:

image

From PDF with this regular expression giving output value with matches option.

Refer to the below attached sample workflow, it may help to loop column wise
Main.xaml (9.0 KB)
Challenge.xlsx (8.2 KB)

Regards,

Hi @sushma_jaladi do the regular expression matches more than one match in a single PDF file ?

yes.

Thank you

No only one match will happen.

Its not reading problem. I have to write in column wise.
Thank you

You can insert Write Cell activity in nested for loop…

I want to update in data table not in excel

Ya then try this way

  1. Put PDF files in one folder and use

List_1 = Directory.GetFiles(folder) it will store the list of file path of PDF in List_1 array

Then intialise another list

List_2 = New list(of Object)

Use build datatable activity to build the resultant datatable u need as output and store in dt2

Read the excel file having regex pattern and store in dt1

Use the following assign activitiy to get the row count of dt1

rowcount = dt1.Rows.Count

Then use for each activitiy to loop through each file in List_1

Use read PDF activitiy to read the PDF file and store in str varaible

Then use for each row to loop through all the regex pattern in dt1

Inside the for each row , use the following

a)use matches activitiy to use the regex pattern input as row(“Regular Expression”).ToString and input string as str

And then set a varaible to stores the collection from matches activitiy as matches_collections

Then append the value in matches_collection in List_2 list. (matches_collection.ElementAt(0).ToString)

Then outside the for each row use add datatrow activity to add the List_2 array to the dt2

Then outside the for each use write range to write the dt2 to excel file

Hope it helps

Mark it as solution if it helps you

Regards

Nived N :robot:

Happy Automation :slight_smile::slight_smile::slight_smile:

Its not working

What error is it throwing

List variable is not working in Add data row. But Array type worked. Thank you

1 Like

U had to convert list to array format by using

List.ToArray

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