Hello! Please, help me. I have 2 one dimensional arrays and 2 columns in a datatable. How do I fill the first column of datatable with the values of the first array and the second column of datatable with the values of the second array?
Hello and good afternoon,
First off I will assume that the arrays are of the same length, if not then you will need two loops instead of a single one. If they are of the same length then you can do as follows
This will loop through each item in array1 (and assuming they are the same length, array2 as well) and add them as a datarow to your table.
Thank you for your reply! I did everything as you said, but an error occurred in the “output” field: “add data row: the index was outside the bounds of the array”. Can you please tell me what it might be connected with?
In the foreach activity, you must check that array2 has element at count index or not.
IF not, please add blank ("").
thank you for your answer, but I didn’t quite understand what needs to be done. Please show how to check if there is a count element in array2 and where to add ("") if it is not there.
@bolbat_evgenia Does both the arrays that you use have the same length ?
Yes, arrays of the same value
ArrayDataToExcel.zip (17.0 KB)
Can you please try the attached workflow file
mark as resolved if you got solution
@bolbat_evgenia What was the mistake
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.