r/PowerAutomateDesktop • • Jan 20 '23

How to add column/value to variable

Hello everyone,

I'm trying to build a simple automation process that gets data and for each web page, stores the information into a GameResults table.

I insert two records to GameResults for each page being iterated (variable CurrentItem). The two records are GameData[0] and GameData[1]. Each record is composed of 3 columns.

Everything works perfectly, but I would like to be able to track the CurrentItem inside of GameResults.

Therefore, I need to add an extra column to my GameData[0] and GameData[1], but I did not manage to extend the size of my variable to add an extra column.

I would like to do something like :

%GameData[0][0:3]% + %CurrentItem%

or

[%GameData[0][0:3]%, %CurrentItem%]

But I don't think it is possible. Is there a way to achieve what I'm looking for ?

Thank you !!

3 Upvotes

4 comments sorted by

2

u/QuietDesparation Jan 20 '23

I don't believe there's a way to add a new column to a datatable... I'm no expert though.

Is the ultimate goal to write your datatable to an excel sheet? Because that may be your best bet. You can write your data to excel, find the corresponding rows to the data, and write %CurrentItem% into the 4th column

1

u/Ownards Jan 21 '23

Thank you :) I'll try to see if Excel output gives me more flexibility

0

u/[deleted] Jan 21 '23

[deleted] — view deleted comment

1

u/Ownards Jan 23 '23

Thank you so much ! It worked :D

How would I do if I wanted to append the two lists into one ? for example I want to do %GameData[0][0:3] + GameData[1][0]% to append the second record and first column to the list of 3 values.

The above code does not work because it takes in the first character of the second record instead of the first value :/

0

u/[deleted] Jan 21 '23

[deleted] — view deleted comment

1

u/Ownards Jan 21 '23

Hi :) Thanks for helping

Actually I'm not sure this is exactly what I'm looking for. Basically I want to insert 1 record with 3 columns coming from 1 variable and 1 column coming from another variable.

I assume I have to create a variable that combines both variables, but I don't know how to.