To achieve this in a Canvas app, you can follow these steps:
- Collect Initial Values on Form Load:
- Use the
OnVisible
property of the screen to create a collection that stores the initial values of the form. For example:ClearCollect(OriginalValues, FormName.Updates)
This will store the initial values of the form fields in a collection namedOriginalValues
.
- Use the
- Track Changes in Field Values:
- For each field in the form, compare its current value with the original value stored in the collection. You can use the
If
function to check for changes. For example:If(DataCardValue.Text <> LookUp(OriginalValues, FieldName = "FieldName").Value, "Changed", "Unchanged")
- For each field in the form, compare its current value with the original value stored in the collection. You can use the
- Collect Changes:
- When a field value changes, you can use the
OnChange
property of the field to update a collection that tracks the changes. For example:Collect(ChangedValues, {FieldName: "FieldName", NewValue: DataCardValue.Text})
- When a field value changes, you can use the
- Compare Changes:
- Use the
ChangedValues
collection to compare the new values with the original ones. This can help you identify which fields have been modified.
- Use the
- Optional – Highlight Changed Fields:
- To visually indicate changes, you can modify the
Fill
orBorderColor
property of the fields based on whether their values have changed. For example:If(DataCardValue.Text <> LookUp(OriginalValues, FieldName = "FieldName").Value, RGBA(255, 0, 0, 1), RGBA(255, 255, 255, 1))
- To visually indicate changes, you can modify the
This approach ensures that you can track and compare changes effectively. Let me know if you’d like more detailed guidance on any of these steps!