Hello,
I'm looking to build a flow and have been struggling with which approach to take.
Our users will enter data into a form . For example, I will collect data as follows-- each line is a new question.
Q1: Name 1
Q2: Role of Name 1
Q3: Name 2
Q4: Role of Name 2
Q5: Name 3
Q6: Role of Name 3
Q7: Course
The form is first sent to Sharepoint, where similar values are being grouped together and stored with a separator. In Sharepoint Lists, it looks like:
Names | Roles | Course |
Name 1; Name 2; Name 3 | Role of Name 1; Role of Name 2; Role of Name 3 | ABCD123 |
With that, I'm hoping to generate a CSV that looks like the following:
Name | Role | Course |
Name 1 | Role of Name 1 | ABCD123 |
Name 2 | Role of Name 2 | ABCD123 |
Name 3 | Role of Name 3 | ABCD123 |
What would be the best way to do so?
Many thanks,
Darren
Solved! Go to Solution.
Hi @drichards1 ,
Glad to see you figured it out.
You could post your solution and mark it as a 'Solution' so that it will be useful for others and close the case.
In addition, I also did a simple test for your reference.
[
{
"Name": Q1,
"Role": Q2,
"Course": Q7
},
{
"Name": Q3,
"Role": Q4,
"Course": Q7
},
{
"Name": Q5,
"Role": Q6,
"Course": Q7
}
]
Result Screenshot:
Best Regards,
Charlie Choi
Hi Charlie,
Thanks for giving this a shot.
I'm attempting to write out my solution. Please know that I am not a Power Automate expert-- so at times I may not be using the correct lingo. Many of these steps I've found from various other threads and have cobbled them together to suit my needs. I truly hope that this is helpful for others. It took a while for me to figure out.
Step 1: I've created the following variables:
Step 2: Convert each string into array by using Compose. I used the split command to do this, one command for each variable. This step is important, because it turns it from a plain string that has semicolons, into something that can be used for array purposes.
Step 3: Build an array of Usernames, Course Codes, and an Index Number.
I created an "Apply to Each":
Step 4: After the Apply to Each, I reset the index variable so that we can use it on another array.
Step 5: Build the next array-- this time, I would like it to include the roles that were submitted for the course.
So, within the apply to each, I've added an "Append to array variable" action:
And of course after appending, I increment my index variable by 1 as well.
Step 6: Combine the two arrays. This is the step where we combine all the data and get the final formatting that we are looking for.
Our final data looks like:
[
I thought I would update the community. I was able to figure this out. It took some time, and I'm not sure I can even articulate the solution, but if anyone would like some info-- I can attempt to explain it!
Hi @drichards1 ,
Glad to see you figured it out.
You could post your solution and mark it as a 'Solution' so that it will be useful for others and close the case.
In addition, I also did a simple test for your reference.
[
{
"Name": Q1,
"Role": Q2,
"Course": Q7
},
{
"Name": Q3,
"Role": Q4,
"Course": Q7
},
{
"Name": Q5,
"Role": Q6,
"Course": Q7
}
]
Result Screenshot:
Best Regards,
Charlie Choi
Hi Charlie,
Thanks for giving this a shot.
I'm attempting to write out my solution. Please know that I am not a Power Automate expert-- so at times I may not be using the correct lingo. Many of these steps I've found from various other threads and have cobbled them together to suit my needs. I truly hope that this is helpful for others. It took a while for me to figure out.
Step 1: I've created the following variables:
Step 2: Convert each string into array by using Compose. I used the split command to do this, one command for each variable. This step is important, because it turns it from a plain string that has semicolons, into something that can be used for array purposes.
Step 3: Build an array of Usernames, Course Codes, and an Index Number.
I created an "Apply to Each":
Step 4: After the Apply to Each, I reset the index variable so that we can use it on another array.
Step 5: Build the next array-- this time, I would like it to include the roles that were submitted for the course.
So, within the apply to each, I've added an "Append to array variable" action:
And of course after appending, I increment my index variable by 1 as well.
Step 6: Combine the two arrays. This is the step where we combine all the data and get the final formatting that we are looking for.
Our final data looks like:
[
Hi Charlie,
Also- I wanted to thank you for your time in drafting this solution. Yours is much simpler- because I am not very familiar with arrays, I did not know you could compose it in the way that you did.
In my case, I am instead pulling from a Sharepoint list value which I was feeding my webforms into (i.e. so Q1, Q2, Q3 as an example are fed into one comma-separated column)... so I think that the solution I did is the only way to achieve it once it is already in the list. Your method is perfect when pulling directly from the form-- and I will use this in future projects.
Thanks again,
Darren
User | Count |
---|---|
102 | |
40 | |
29 | |
23 | |
16 |
User | Count |
---|---|
132 | |
52 | |
50 | |
36 | |
24 |