May 26 2023 05:13 AM
Hello everyone!
I have a list with five columnd, "Car" "Owner" "Situation" and so on
Column "Situation" can be WORKING or DAMAGED
On another page, i need to summaryze this situation, with a green FLAG if all Car are WORKING, or a red FLAG if just only one is DAMAGED
I hope I haven't to do a powerapp for this kind of control..
I cannot show the entire list working only with colours in the whole column...
Really thanks for your support
M
Jun 01 2023 02:09 AM
@MM_Enginess you don't need to build a power app for this (although it's always an approach I would consider seriously), but as you can't do comparisons across different items in a list to get an overall summary you will need a flow in Power Automate and a second list to hold the current overall situation.
The list that holds the details of each vehicle is shown below:
The list with the overall condition is shown below. Create a new item which will be updated later with real data.
Create a new view of that list and format it in advanced mode with the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"hideColumnHeader": true,
"hideSelection": true,
"rowFormatter": {
"elmType": "div",
"style": {
"padding-bottom": "20px"
},
"customCardProps": {
"formatter": {
"elmType": "div",
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flag"
}
}
]
}
},
"children": [
{
"elmType": "div",
"style": {
"border-radius": "15px",
"display": "block",
"font-size": "14px",
"background-color": "=if([$DamagedCount]==0, '#006666', '#800000')",
"color": "white"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flag"
},
"style": {
"padding": "10px",
"font-weight": "Semi-Bold",
"color": "#ffffff"
}
},
{
"txtContent": "[$Title]",
"elmType": "div",
"style": {
"font-weight": "Semi-Bold",
"margin": "0.35em"
}
},
{
"elmType": "div",
"txtContent": "[$DamagedCount]",
"style": {
"padding": "5px",
"flex-direction": "column"
}
}
]
}
]
}
}
Flow
1. In your flow the trigger I've used is a recurrence schedule that runs at 7am every weekday:
2. Next add a float variable and set its initial value to 0. This variable will hold the number of damaged vehicles:
3. Next, add a get items action. I've set the filter query to Situation ne null in case a vehicle has been added to the list but no situation has been added yet:
4. Add an apply to each and select value from the dynamic content box:
5. Inside the apply to each add a condition where Situation Value is equal to Damaged. In my list it is a choice column of Working or Damaged so you need to select Situation Value, not just Situation. Leave the red if no channel empty. In the green if yes channel add an increment variable action, select the variable and set the value to 1:
6. Outside of the apply to each add an update item action and select the site and the live where you have the overall situation. Set the date column to the expression utcNow() and select varDamaged for the DamagedCount field.
Add the list web part to the SharePoint page, set the view to the view where you formatted the column earlier with JSON.
If the DamagedCount column is 0 it will display the overall situation in green, but if the DamagedCount column is 1 or more it will display it in red:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)