How to add Data without the addition of Rows

Greetings friends,

I am new to this and am trying to do the following:

  1. Have a User input a few parameters (eg. Age, Gender, Height, Blood Group)
  2. Store them as Variables
  3. Add them to a Data Table with 4 Columns (for the 4 inputs) and 2 Rows (One for the Header and One for the input)
  4. Write out a CSV with the values

However, I am getting the output CSV with the data in a staircase pattern. How do I make sure that they are in the same row?

I have tried the For Each Row and the Parallel control flow. But these commands are not writing anything to the data table.

Please help on which command that I should use? I am currently using Add Rows command as when browsing thru this forum, it seems to be the only way to add Variables to a Data Table.


1 Like

Hi @Sai_Prashanth

Add data row is the activity you have to use to add the variables to a data table. In this activity you have to use the array row property to add them to the DT as an array.

How are you writing the data to the csv file? Are you using write csv? Append csv or something else?


Hi @Lahiru.Fernando,

I have been using the array row property. I can get my variables into the right columns but the rows are wrong. I simulated an output with junk values to let you have a look.

I am using “Write CSV” at the end to generate the CSV file. Capture

Edit: Is there any commands to bring these rows up to the second row?

1 Like

@Sai_Prashanth it looks like it’s a problem with your loop and you’re moving up in columns AND rows while performing your actions instead of doing each action on each columnand then looping to the next row

1 Like

Dear @Hennesy,

May I enquire if in the Add Data Row activity and subsequently the ArrayRow function, is there any command that I should use? For my second column, for example, I am using: {“”, Base1 , “” , “”, “”}

Edit: Uploaded a screenshot to show you my addition of the variables to the data table.

1 Like

@Sai_Prashanth, 1 ‘Add Data Row’ Activity per line. Have a look at the attached

Main.xaml (8.6 KB)

1 Like

Welcome to Uipath Community,

Just 1 Add Data Row Activity is suffice, however, please ensure that the ArrayRow property is filled in with the following format {Variable1, Variable2, Variable3, etc} and remember to set your DataTable to your output datatable variable, this should solve your problem of writing to different lines. as using multiple add data rows means you are adding multiple rows. please take note. if you wish to use multiple activities like what you demonstrated earlier, please use write cell instead.


1 Like

Dear @MythicGold,

Your advice was great! I tried it out and it works! Thank you for your time.

Warmest regards,
Sai Prashanth


Thank you for your time. Your example was really useful in helping me solve my problem.

Warmest regards,
Sai Prashanth

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