Hello,
I am working on a FORM where a textbox (SubstationInput) is set to pull a SP column value based on a Lookup function and the below code works perfectly. Basically the code will auto-populate the location on the Textbox if Lat/Long values match the SP columns if not it will display as " You are not at a substation".
With(
{
wRecord: LookUp(
'SharePoint List',
field_1 = Location.Latitude && field_2 = Location.Longitude
)
},
Coalesce(wRecord.Title, "You are not at a Substation")
)
I also have a button on the same form to choose a location if the user is not at a Substation. The button opens a Gallery with list of locations to choose and I have the Gallery Onselect property as Navigate(NewFormScreen).
Now what I want is that initially when the form opens the textbox should auto-populate the location and if when a user select's a location in the list then the screen should navigate back to form and clear the existing text and the selected location should be populated on the SubstationInput Textbox. I am able to achieve this separately (using below code on the Textbox default property) without the lookup function and it works perfectly.
BrowseGallery2.Selected.SubstationName
But I am stuck achieving both functionality together (Location auto populate using lookup function & pass text from gallery onselect to same textbox by clearing exiting text). So far I have the below using If condition but throwing error.
If(!IsBlank(SubstationInput.Text),
With(
{
wRecord: LookUp(
'SharePoint List',
field_1 = Location.Latitude && field_2 = Location.Longitude
)
},
Coalesce(wRecord.Title, "You are not at a Substation")
)
), BrowseGallery2.Selected.SubstationName
Please help.