Objective: sort a SharePoint List of tasks in a gallery by sort ID that is a combination of project ID and staff ID.
Challenge: project ID and staff ID are lookup columns taken from a list of projects and a list of staff; SharePoint Lists cannot create a calculated column using lookup columns; Power Apps cannot run SortByColumns on calculated or lookup columns; therefore, the sort ID column must be a text column.
Approach: populate the sort ID column using a non-visible DataCard in the Power App edit screen; set the Default and Update fields of the DataCard to concatenate the project ID DataCard and staff ID DataCard, as follows. (Note: the underlined object names have been adjusted to show context.)
- Concatenate(First(DataCardValueStaffID.SelectedItems).Value,Text("-"),First(DataCardValueProjectID.SelectedItems).Value)
Issue: the sort ID column is sometimes not correctly populated when an item is created in the Power App in Teams; the result is just the joining hyphen "-"; however, it is populated if the item is updated later.
Measures: changed the DelayOutput field of the DataCardValue to false, but no improvement.
Alternatives: possible to create a Power Automate flow to concatenate columns, but I would prefer to only have the Power App manipulating the list data.
Questions: Any idea why the Concatenate formula sometimes does not populate the column?
Also, can anyone suggest an alternative approach to either creating a concatenated text column in SharePoint Lists or sorting a gallery using lookup column data?