Hi,
I have a Sharepoint list consisting of these columns of Yes/No data type.
Acceptable Usage Policy |
Assets Management Policy |
Email & Information Exchange Policy |
Information Security Policy |
Endpoint Security Policies & Procedures |
Information Security Incident Management |
Teleworking Policy |
Non-Conformity and Corrective Action Policy |
Backup Policy |
Human Resources Security Policy |
Mobile Device Policy
|
Short, quick and easy to maintain, but property names are encoded at the end:
Select
From:
xpath(
xml(json(concat('{"Root":{"Item":', outputs('Compose'),'}}'))),
'/Root/Item/*'
)
Map:
xpath(item(), 'name(/*)')
Select 2
From:
union(body('Select'), json('[]'))
Map Label:
item()
Map Trueish:
greater(
xpath(
xml(json(concat('{"Root":{"Item":', outputs('Compose'),'}}'))),
concat('count(/Root/Item[', item(),'="true"])')
),
0
)
Output:
[
{
"Label": "Name",
"Trueish": false
},
{
"Label": "Acceptable_x0020_Usage_x0020_Policy",
"Trueish": true
},
{
"Label": "Assets_x0020_Management_x0020_Policy",
"Trueish": false
},
{
"Label": "Email_x0020__x0026__x0020_Information_x0020_Exchange_x0020_Policy",
"Trueish": true
}
]
Notice: "Label" is encoded for XML node names (basically ASCII hex).
After filtering this output, you get the wanted list.
Hi @Vaheeth_Raj ,
Sorry for the late. I finally think of a way to get through it! Please follow below steps:
1. Create an array in Compose to include all the column names (you must find the internal column names in list settings, select the column, copy the name from url):
[
"AcceptableUsagePolicy",
"AssetsManagementPolicy",
"EmailInformationExchangePolicy",
"InformationSecurityPolicy",
"EndpointSecurityPoliciesProcedures",
"InformationSecurityIncidentManagement",
"TeleworkingPolicy"
"Non-ConformityandCorrectiveActionPolicy",
"BackupPolicy",
"HumanResourcesSecurityPolicy",
"MobileDevicePolicy"
]
2. Initialize an empty array variable.
3. In Apply to each control, looping through this array, Get items using Filter query:
items('Apply_to_each') eq 1
4. Checking if at least 1 item is there in the list in Condition control
5. If true, it means this column has at least one tick, so append to array variable using this column name and YES
items('Apply_to_each'): YES
6. Use the array variable to create an HTML table, use this table in body of Send Email action.
Best regards,
Hi,
Yes you are right
Hi @Vaheeth_Raj ,
Let's take the screenshot as example. There are 5 rows with 5 columns, and only 2 columns include ticks, so the output you want are:
Acceptable Usage Policy | Yes |
Assets Management Policy | Yes |
Am I right?
Best regards,
Hi,
My main Requirement is to display only the column names which are marked as "Yes"(TickMark).
Let's say there are 10 columns and out of those only 5 columns are marked as "Yes"(TickMark).
I need these 5 column names as an output. Simple. I hope this is clear.
I shall take care of the mail body.
Hi @Vaheeth_Raj ,
I really don't understand what you want to output from Compose and put in mail body. Could you make a more specific example in a screenshot, using the table your provided originally?
Best regards,
Hi,
The mail body template is the output of the compose action.
I usually use select data operation -> Create HTML Table -> Compose -> send an Email(V2),
I want to display two columns in output,
1. Policy Name which is the column name in the sharepoint list
2. Acknowledgment - Yes / No
I want to filter out the column names which are showing Yes(Tick Mark) only.
Hi,
Can i use a loop condition to check each of the column , if true then it appends to a variable.
The output of the variable can be the content of my mail body.
I want a solution like this. I have the idea but not able to execute.
If u know to implement this idea please help me with the screenshot of the steps.
Hi @Vaheeth_Raj ,
You will need expressions for each column, hardcoding column names. For example:
if(equals(items('Apply_to_each')?['Acceptable Usage Policy'], true), 'Acceptable Usage Policy', '')
Best regards,
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional