This formula is inefficient.
Set(device,LookUp('My List Name',ID=Value(Param("ID"))));
If(
!IsBlank(Param("Id")),
Navigate(DetailScreen1,ScreenTransition.Fade)
)I would not waste resources on an unnecessary lookup when Param() is obviously situational. My original formula would only perform a lookup when a Param exists.
If(
!IsBlank(Param("Id")),
Set(vardevice,LookUp('My List Name',ID=Value(Param("Id"))));
Navigate(DetailScreen1,ScreenTransition.Fade)
)
Beat,
What you did will work
If(!IsBlank(varDevice), varDevice, RequestGallery.Selected)
However, I personally would approach it a different way. If coming from a link, with a Param, OnStart will populate varDevice and navigate to DetailScreen1.
If not, the user will be presented with the gallery screen. Whichever control, in the gallery, that is used to navigate to DetailScreen1 would use the following formula... Assuming you still want to use a context variable.
Navigate(
DetailScreen1,
Fade,
{varDevice:BrowseGallery.Selected}
)Now the form only needs varDevice in the Item property. This might also give you the Item not Found you wanted with an invalid Param.
Chris - IW Mentor PowerApps Training