1. Create a Collection to Hold the Filtered Items:
First, filter the collection based on the LineClass and ItemName you want to display in the gallery. Then, create a new collection containing this filtered data, including a column to determine if an item is a duplicate.
ClearCollect(colFilteredItems,
AddColumns(
Filter(YourCollection, LineClass="Class1", ItemName="Pipe"),
"IsDuplicate", false
)
)
2. Identify Duplicates and Store in a Separate Collection:
Use the With scope to create an alias for the filtered collection. Then, use ForAll to go through this alias, storing the duplicates in a new collection called colItemsToPatchAsDuplicate. Use If to include the record if it's a duplicate, and Blank() otherwise.
With({wColFilteredItems: colFilteredItems},
ClearCollect(colItemsToPatchAsDuplicate,
ForAll(wColFilteredItems,
If(
CountRows(
Filter(colFilteredItems,
ItemCode=wColFilteredItems[@ItemCode],
Description=wColFilteredItems[@Description],
Size=wColFilteredItems[@Size],
Size2=wColFilteredItems[@Size2]
)
) > 1,
ThisRecord,
Blank()
)
)
)
)
3. Remove Blank Records from the Collection:
Remove the Blank() records from the collection using ClearCollect again and filtering out the blank items.
ClearCollect(colItemsToPatchAsDuplicate, Filter(colItemsToPatchAsDuplicate, !IsBlank(ThisRecord)))
4. Update the Filtered Collection with the Duplicate Markers:
Patch the colFilteredItems collection by going through colItemsToPatchAsDuplicate.
Patch(colFilteredItems, colItemsToPatchAsDuplicate, ForAll(colItemsToPatchAsDuplicate, {IsDuplicate: true}))
5. Create the Gallery and Apply Conditional Formatting:
Use the colFilteredItems collection as the source for your gallery, and apply conditional formatting to highlight duplicates.
For example, use a label to display the ItemName, and set its Fill property to change the background color if the item is a duplicate:
If(ThisItem.IsDuplicate, RGBA(255, 0, 0, 0.2), RGBA(255, 255, 255, 0))
This formula should apply a light red background to any duplicates in the filtered gallery, helping the reviewer focus on those specific items.
Remember to replace YourCollection with the actual name of your collection, and adjust the filter conditions and fields as per your requirements.
See if it helps @Dulat