Re: Sort Formula Help on Gallery w/ SharePoint Data Source and Choice Field
@whatsthisdo -
Typically, we populate an EditForm or DisplayForm control with a record based on a Gallery selection as you have done.
However, with an EditForm or DisplayFormcontrol, the DataSource property and the Item property must not only read from the same data source, but the data source it is reading must also have the same schema as the Items property of the Gallery control.
Whenever use a "transformative" function such as the AddColumns or GroupBy, the schema of the Items property of the Gallery is changed. Because of this, the Item property of the Form, and the Items property of the Gallery control, no longer share the same data source schema.
To address this, we can use a LookUp function directly against the unmodified data source to return the correct record.
On the Item property of the Form control, enter:
LookUp(
'Your DataSource'
ID = BrowseGallery1.Selected.ID
)
Or ideally use a Context or Global Variable, the most simplest being a Global Variable which is scoped to the app and therefore persistent across all screens.
On the OnSelect property of the Gallery, enter:
Set(
gbl_record;
ThisItem
)
On the Item property of the Form, enter:
LookUp(
'Your Data Source'
ID = gbl_record.ID
)