This is what I've done so far:
I have three branches:
Branch 1 - Get SharePoint list from this image:
and set it to an array (varMembers_Completed [Title, EID]).
Branch 2 - Get all members from a SharePoint list and set it to an array (varMembers [EID]).
Branch 3 - Get Training List.
--------------------------------------------------------
For each title, I would like to compare varMembers and varMembers_Completed.
If an EID matched from varMembers and varMembers_Completed that means that he/she has completed the training, no action needed.
Else, I would like to place it on a list.
So the overall output, for example on an email should look like this:
Training Title: Test
[Names of those who are not on the list yet]
Training Title: Test2
[Names of those who are not on the list yet]
My bad. I've joined it from the FilterWhoDidntAttend. It should be SelectEIDFromDidntAttend.
Thanks for such huge help @DamoBird365!
Hi @Odie
No idea where that has come from. If you are not doing any further transformation on the select array, I would use the select array. Take a look at the history output of the select array - you will see the output. I cannot imagine that the foreach is actually doing anything to it.
Damien
As for the union, the formula is:
Seems that I have to update my flow as it would be running on a huge data. The forEach is really taking time.
No update is happening on the flow, just an email that I have to send for the trainings.
Thanks for the tip!
Hi @DamoBird365 - It seems that the output from the compose returns an object.
The output from the SelectFromDidntAttend is as follows:
[
"User1",
"User2",
"User3"
]
It seems that the "EID" key is also being appended to the compose. What can I do to extract only the value?
Mmmm... Select is an array and you have defined the two key/value pairs. You only need an array in a variable action if you want to update it, otherwise a select or compose will serve the purpose of a read only variable.
What's happening in union?
Just wondering if you need all of that extra stuff and make your flow even more efficient.
Damien
@DamoBird365 - I basically have 3 SharePoint list for the three branches.
Mapped the list to a select, then used a forEach to create an array and assign it on my array variable.
Hi @Odie
If you add a select and compose to your apply to each and then two composes outside of your apply to each like so, this will bring everything together for 1 email. I am assuming it's 1 email, rather than an email per course.
Select:
item()?['EID']
Compose :
Training Title items('Apply_to_each')?['Training Title']
Join(body('SelectEIDFromDidntAttend'),', ')
ComposeReturnLine
Literally slap a return key in there 👍
ComposeString:
join(outputs('ComposeStringObject'),outputs('ComposeReturnLine'))
Output is as follows:
And users will be comma separated if more than 1.
I'll probably do a wee video on this concept as it is a really good use case. Thanks for the challenge 😉
Please consider accepting my answer as a solution if it helps to solve your problem.
Cheers
Damien
Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks
Thanks! It worked perfect. Can you give me an idea on how to achieve this output:
Training Title: Test
[Names of those who are not on the list yet]
Training Title: Test2
[Names of those who are not on the list yet]
...
I would like to use the output and send it using Outlook Email.