How to input vars into data table

Hello,

I am trying to input variables into a data table that is built in the beginning of a sequence.

The sequence goes like this (macro level):

1.) Build Data Table (7 columns that are named {Name, Phone, Address, Distance, Specialty, Reviews, Status)

2.) Do While Loop - We are pulling line item information and allocating them individually into 7 variables that would go in their appropriate column name (vars have same name as column name in data table)

3.) For each line item we would add another row with the 7 vars going into their appropriate columns.

Unfortunately, it doesn’t seem to be working. Any help is much appreciated.

Thanks.

Can you be more specific?

Are you getting any errors

or

values are being assigned to different columns

or

nothing is being inserted?

Apologies…so I am setting it up using ‘Add Data Row’

In the properties panel, in the ‘Input’ field I have it set up like this:

{ vMdName, vDistance, vSpecialty etc…}

However the final output which I put to an csv file only shows the first column (vMDName) being populated.

Your while loop will get all variables for a row in one loop, Correct?

Is your logic similar to below:

Build DataTable will columns ----> dtTable

While (Line <> string.empty)
{
vMdName = line(1).Tostring(); //line is array split column wise from your source
vDistance = line(2).ToString()

AddDataRow
{ vMdName, vDistance, vSpecialty etc…} → In ArrayRow
dtTable —> in DataTable
}

WriteCSV -----> dtTable

Overall structure is correct but inside while loop is different…similar to this:

1.) Build Data Table
2.) While ‘Object Exists’
- Pull line item info and allocate to variables.
- Add data row (same array row setup as previous post
3.) Write csv (after while loop ends)

Looks fine for me, unless something is missing at “Pull line item info and allocate to variables.”

Attaches is sample for your reference

csvexample.xaml (8.4 KB)

2 Likes

THanks so much!

Were you able to figure out the reason?

1 Like

HI vvaidya,

Unfortunately this did not work for me.

I know there’s not much context for you in this xaml sequence but maybe u can see where I am coming from and can help out with the data table building.

DOWHileSequence.xaml (67.9 KB)

Inside the sequence called ‘Line Item Content Loop’ is where I am pulling out the values and allocating to their appropriate vars…at the end of this sequence is where I want to add to the datatable.

Hope this makes sense.

Are you adding only two columns values to datatable in Add Data Row?

I see this : {vMD_Name, vMD_Distance}

Nope its 7 total…I only included two in this sequence to try and prove the concept.

In the Build Data Table activity you can see the column names

Did you check writing those column values to write line and you are able to see the values?

Yep they definitely have values I write all variables into a write line activity tro confirm this…but actually inputting into the ‘Add Data Row’ activity is where the problem is

I see 8 columns, you mentined 7 above

1 Like

Whoops, apologies.

8 is correct.

Hello, did you get a solution to this? I am also having the same problem, I have build the data table but I want to pass variables into the columns

did you get an answer to this?

1 Like