Hi,
1. Power Automate Setup
Flow Trigger:
Trigger: PowerApps
Add Parameters:
Use the "Ask in PowerApps" option to add two parameters:
colMinStock (Array)
colAssetsStockNew (Array)
These should be Power Apps collections serialized as JSON.
2. Process Collections in Power Automate
Initialize Variables:
varMinStock → type: Array, value: colMinStock
varAssetsStockNew → type: Array, value: colAssetsStockNew
varMinStockReport → type: Array, value: []
Apply to Each: Loop over varMinStock
Inside the loop:
Current Item: currentCatalog
Step A: Filter colAssetsStockNew
Use a Filter array:
From: varAssetsStockNew
Condition: item()['CatalogID'] = items('Apply_to_each')?['CatalogID']
Step B: Count Matches
Use a Compose action:
length(body('Filter_array'))
Step C: Append to Report Array
Use Append to array variable varMinStockReport:
{
"CatalogID": "@{items('Apply_to_each')?['CatalogID']}",
"Name": "@{items('Apply_to_each')?['Name']}",
"MinimumStock": "@{items('Apply_to_each')?['MinimumStock']}",
"Quantity": "@{outputs('Compose')}"
}
3. Create HTML Table
Action: Create HTML Table
From: varMinStockReport
Columns: Automatic or Custom
4. Send Email
To: you@domain.com
Subject: Min Stock Report
Body:
<h2>Minimum Stock Report</h2>
@{outputs('Create_HTML_table')}
If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
Regards,
Riyaz