Hi everyone,
I have a scheduled flow that gets generated Monday morning and the flow looks like this:


The loop wherein I am adding rows and also checking if the current week does it have any Holiday for which I have maintained a separate list


So now I had one more requirement which was some individuals report to office daily (no hybrid mode) that is their work mode status will be WFO. So for them I wanted to add 'WFO' for all the date columns only for those individuals. So I had created a variable (array type) wherein I mentioned those individuals emails like:

Now in the same loop (Add members to Excel) after checking for Holiday or not I wanted to perform a check if the current email (from the Teams action does it match with any of the email defined in the variable (WFO members) if it does then append 'WFO' else leave it blank.
So I have a expression in my mind which is like:
contains(variables('WFO_Members'), items('Add_Team_Member_to_Excel')?['email'])
But I am not sure whether it is correct and the second thing I am not sure where do I need to place it and How?. And the other thing is if the particular column is already marked as Holiday from the previous check (that particular day like Christmas : 25th Dec) in that case it should not add the WFO text for the set of employees defined in the variable.
Just an update:
So I have created a variable (Initialize variable: Renamed it to WFO Members) and the actual variable name is set to WFOMembers

Then in the Add_Members_to_Excel (Apply to each loop):
In the existing expression have modified it a bit i.e. made use of another if loop:
(To check if they belong to the WFO members i.e. current record email)
if(contains(join(body('Select'),', '),split(outputs('Header'),',')[3]),'Holiday',if(contains(variables('WFO_Members'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')
In the outer if (first if):
Check: If the current weekday is there any Holiday:
if(contains(join(body('Select'),', '),split(outputs('Header'),',')[3]),'Holiday',
Then in its else part:
(Check if the current record/item email are they part of WFO_Members array:
if(contains(variables('WFO_Members'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),
And if its not satisfied:
Then leave it blank:
''
The complete expression in the Row action:
{
"SNo": "@{variables('varCounter')}",
"Employee Name": "@{items('Add_Team_Member_to_Excel')?['displayName']}",
"Employee Email": @{items('Add_Team_Member_to_Excel')?['email']},
"@{split(outputs('Header'),',')[3]}": "@{if(contains(join(body('Select'),', '),split(outputs('Header'),',')[3]),'Holiday',if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')}",
"@{split(outputs('Header'),',')[4]}": "@{if(contains(join(body('Select'),', '),split(outputs('Header'),',')[4]),'Holiday',if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')}",
"@{split(outputs('Header'),',')[5]}": "@{if(contains(join(body('Select'),', '),split(outputs('Header'),',')[5]),'Holiday',if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')}",
"@{split(outputs('Header'),',')[6]}": "@{if(contains(join(body('Select'),', '),split(outputs('Header'),',')[6]),'Holiday',if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')}",
"@{split(outputs('Header'),',')[7]}": "@{if(contains(join(body('Select'),', '),split(outputs('Header'),',')[7]),'Holiday',if(contains(variables('WFOMembers'),items('Add_Team_Member_to_Excel')?['email']),'WFO'),'')}"
}
So I saved the flow and tried to test it manually but got the following issue:

Have I missed something?
So if you guys can help me, it will quite helpful.
If you need any more information do let me know.
Note:
Starting from tomorrow (16/07/2024 to 22/07/2024) probably we might not able to comment on the post as there is some transition that will be happening (from Microsoft) so in that case if comment is disabled, you can message me where we can continue the discussion.
Regards,
Sidhant.