Hello guys. I have a problem that I dont know how to solve. I have a workflow, that reads excel file that has input needed for a webpage. Then goes to the web, extracts data and goes to another page. The thing is, that I need to write the input for the webpage to the extracted data table. For example, I extract 4 rows of data from the web, then I need to add 4 rows to the table of input. Input is CurrentRow.Item(“All Orgkodas”).ToString. How can i do that?
Hi Povilas_Jonikas,
- declare new DataRow variable e.g. “newRow”
- initialize “newRow” to be a new row of your datatable by assining dt.NewRow to “newRow” variable
- assign values to newRow variable e.g. newRow(“All Orgkodas”) = “test”
- after all the values are assigned, use “Add Data Row” activity, fill in dataRow and dataTable properties. (Note - you can use ArrayRow property by passing in newRow.ItemArray)
Cheers!
-
Use the “Build Data Table” activity to create a new DataTable. Create columns in that according to your needs.
-
Use a “For Each Row” activity to go through the extracted data from the webpage.
-
Inside the loop, use the “Add Data Row” activity to add each row of extracted data to the newly created DataTable.
-
Once all rows are added, you can write the DataTable to your Excel file using the “Write Range” activity.
Hope this helps
Hey @Povilas_Jonikas
You can use vb.net
inputDataTable
of type DataTable
(In Argument)
webDataTable
of type DataTable
(In/Out Argument)
If Not webDataTable.Columns.Contains("All Orgkodas Input") Then
webDataTable.Columns.Add("All Orgkodas Input", GetType(String))
End If
For index As Integer = 0 To webDataTable.Rows.Count - 1
Dim webRow As DataRow = webDataTable.Rows(index)
If index < inputDataTable.Rows.Count Then
Dim inputRow As DataRow = inputDataTable.Rows(index)
webRow("All Orgkodas Input") = inputRow("All Orgkodas").ToString()
Else
webRow("All Orgkodas Input") = String.Empty
End If
Next
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.