cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Execute SQL - Multiple columns

I have the following scenario:

 

Select EmployeeName, Phone, Email from Emplyees

 

The action places the results in a collection, which appears to be single dimensional. How do I access the other columns?

 

Please let me know if further clarification is needed.

 

Thanks in advance!

Labels: (1)
0 Kudos
Reply
5 Replies
Not applicable

Re: Execute SQL - Multiple columns

Hi Saeid there is radion button "Specify column names". After selecting it you will be able to add as many columns as you want to retrieve from query to your result collections.

0 Kudos
Accept as Solution Reply
Not applicable

Re: Execute SQL - Multiple columns

Hope that works, Saeid Angadji​. Let us know if Donatas Krušna​'s answer is correct.  Thank you!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Execute SQL - Multiple columns

Thank you, that was helpful. I was able to put the other columns in separate collection variables. Now, when I run a For Each loop for the first column, how do I access the value from the second column with the same index?

For example, I'd like to read through a SQL table with 3 columns and insert the rows in a SharePoint list.

Thank you,

0 Kudos
Accept as Solution Reply
Not applicable

Re: Execute SQL - Multiple columns

Hi, again.

 

First of all create variable which will hold the count of your collection variable. This count is the same for your all collections because these collections are produced from the same SQL query. So next step is to use simple loop action which will run until your index variable will reach your count variable value. In this loop action use collection actions to get items from collection variables by index and in the end you will be able to create list items.

 

Hope This will help.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Execute SQL - Multiple columns

Thank you!

0 Kudos
Accept as Solution Reply