cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SeanHenderson
Impactful Individual
Impactful Individual

Form Only Displaying Items in Gallery Title or Subtitle When Using Record Variable

Hi,

 

I am using a parameter to deep link to a gallery item in my app. This requires me to use a variable for the gallery navigation.

 

So for the gallery, I have the OnSelect set to:

Set(varParamNav, Gallery1.Selected)

 

Which should set the variable to be the entire selected record.

 

Then for the form Items property I set it to:

varParamNav

 

So selecting an item in the gallery should set the variable as a record, and the form should read that record. However, the only thing the form reads is whatever fields are in the gallery. So if I have Name and Age as Title and Subtitle in the gallery, those fields display on the form. If I change Age to Created On in the gallery, then Age will be blank on the form, but Created On will display the correct value.

 

I've disabled all the OnStart formulas, I've tried creating a new screen with a new data source and replicating it there in isolation, but it still doesn't work. Which is strange because simply setting a record to a variable and using that variable as the Item on a form works in any other app I've built.

 

At this point I would even appreciate troubleshooting ideas, because I feel like I've exhausted all of them.

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

Instead of using a variable, try using a collection.

ClearCollect(colParamNav, Gallery1.Selected)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
Pstork1
Dual Super User III
Dual Super User III

Instead of using a variable, try using a collection.

ClearCollect(colParamNav, Gallery1.Selected)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

SeanHenderson
Impactful Individual
Impactful Individual

@Pstork1 

 

I tried that, but unless I am mistaken, you can't use a collection as the Item property of a form.

You are correct that you can't use a collection as the item property of a form since its expecting a record.  But you can use First(collection) as the item property of a form.  That is the first record in the collection.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
SeanHenderson
Impactful Individual
Impactful Individual

@Pstork1 

 

Thank you, that works for the navigation of the gallery.

 

However, it is not navigating to the proper gallery item on start. The gallery item is build into an email using the web link ending in:

&ParamNav="&Gallery1.Selected.Entityguid

 

The OnStart is set to:

If(!IsBlank(Param("ParamNav")), ClearCollect(colParamNav, Lookup(Entity, Entityguid=GUID(Param("ParamNav")))))

 

I also tried:

If(!IsBlank(Param("ParamNav")), ClearCollect(colParamNav, First(Filter(Entity, Entityguid=GUID(Param("ParamNav"))))))

 

When I open the app using the generated link in the email it just opens to the first item in the gallery, rather than the item the email was sent from.

If I follow what you are doing I think you are going about it the wrong way.  The Form is now built to display whatever is selected in the Gallery.  So onStart you need to set the selected property on the gallery to point to the record that matches the parameter.  Setting the Collection will set the Form, but then be overridden when the Gallery defaults to the First record.  So you need to set the default property of the gallery to point to a variable and then set that onStart set that variable equal to the record you want to be the selected record based on the param



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
SeanHenderson
Impactful Individual
Impactful Individual

@Pstork1 

You mean the Default for the gallery to:

varParamNav

and the OnStart to:

If(!IsBlank(Param("ParamNav")), Set(varParamNav, LookUp('Hazard Reportings', 'Hazard Reporting'=GUID(Param("ParamNav")))))

 

Is that right? I have a timer that controls the navigation to the details screen with OnTimerEnd set to:

(If(!IsBlank(Param("ParamNav")), Navigate(DetailHazardReport, Cover)))

 

It goes to the details screen, but doesn't display any data (getting your data...) and if I click the back button to return to the gallery, it immediately returns me to the detail screen.

I would try removing the timer driven navigation until you are sure the gallery is showing the right selected record.  Then you can see about re-adding the direct navigation.  But you are on the right path.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
SeanHenderson
Impactful Individual
Impactful Individual

@Pstork1 

So here's how I got it to work. I would love if you could audit my steps and see if I made things more complicated than necessary.

 

All of the previous navigation around the gallery using a collection is the same.

 

For OnStart I set it as:

If(
    !IsBlank(Param("ParamNav")),
    ClearCollect(
        colParamNav,
        LookUp(
            Entity,
            Entityguid = GUID(Param("ParamNav"))
        )
    )
);
If(
    !IsBlank(Param("ParamNav")),
    Set(
        varParamNav,
        LookUp(
            Entity,
            entityguid = GUID(Param("ParamNav"))
        )
    )
)

Default of the gallery is:

varParamNav

 

I added a timer to navigate to the details screen. It's OnTimerEnd property is:

If(!IsBlank(varParamNav), Navigate(DetailHazardReport, Cover))

 

and on the Back button on the details screen the OnSelect property is set to:

Navigate(BrowseHazardReports, Cover); Set(varParamNav, Blank())

 

Everything seems to be working that way. Thank you for your help!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (83,531)