cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Gallery does not update after form submits changes/adds entry gallery is displaying

Screenshot attached for context.  The item property of both the gallery and the form in question is a variable I set based on what's selected in a different gallery. [ Set(WorkOrderSelected,G_obb_WorkOrders.Selected) ] 

 

I know the submitform is working, because it's changing the entries on the sharepoint list, but this is not reflected in the gallery on the same screen as the form.

 

The submit button below the form does:
SubmitForm(Form7);
Refresh(SPlist)

 

What's broken?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

@DCpower 

That's an interesting and a little unusual use of a Gallery, but, so it is...

 

The issue you have is that the gallery is based on a variable.  The point in time that you set the variable is a snapshot of that record at that time.  It will never update or change until you set it again.

If you get rid of the variable and go direct to the source, you should have better results.

Set your Items property to G_obb_WorkOrders.Selected

This will at least have this gallery update with the current values of that G_oob_WorkOrders gallery.  HOWEVER, if that gallery is based on a variable or a collection, then it still will not change as, again, those are snapshots from the time that they were created.  If you want true dynamic changing and updating, then you need to use the datasource directly in your formulas.  If you use variables and collections, you will need to constantly update them as you change things.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

@DCpower 

You mention that "... the item property of both the gallery and the form...".

Gallery does not have an Item property.  It has an Items property and the question would be, what is the Items property of the Gallery?

If it is set to a collection or other variable, then you will need to recollect or restate whatever that is based on in your submit.

If it is based on a datasource directly, then it will update by itself without any refreshes or other actions needed.

 

I hope this is helpful and leads to a solution for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Frequent Visitor

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

Randy,

Thank you. The Items property of the gallery is the same variable as the form, "WorkOrderSelected"
How should I go about updating that? The variable "WorkOrderSelected" is derived from the expression:

 

Set(WorkOrderSelected,G_obb_WorkOrders.Selected)

 

in a different gallery's onselect.

Highlighted
Super User III
Super User III

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

@DCpower 

This should not be working at all...you are setting the WorkOrderSelected to an individual record (from what I see) and then you are setting the Items property of the Gallery to the WorkOrderSelected?  That should be giving you an error as you are trying to put a record in where a table is expected.

Are you sure you're not referring to a Form or other Item property?

Perhaps some screenshots might help - of the formulas and properties.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Frequent Visitor

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

Yes, WorkOrderSelected is an individual record grabbed based on what was selected in a different gallery, and I've set the gallery selected in screenshot PA1 to have it's items property as that record. I only want one record displayed. I used a display form before and using a gallery was an experiment to see if the gallery would update, as the form would not. It failed.

 


Screenshots included.

Highlighted
Super User III
Super User III

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

@DCpower 

That's an interesting and a little unusual use of a Gallery, but, so it is...

 

The issue you have is that the gallery is based on a variable.  The point in time that you set the variable is a snapshot of that record at that time.  It will never update or change until you set it again.

If you get rid of the variable and go direct to the source, you should have better results.

Set your Items property to G_obb_WorkOrders.Selected

This will at least have this gallery update with the current values of that G_oob_WorkOrders gallery.  HOWEVER, if that gallery is based on a variable or a collection, then it still will not change as, again, those are snapshots from the time that they were created.  If you want true dynamic changing and updating, then you need to use the datasource directly in your formulas.  If you use variables and collections, you will need to constantly update them as you change things.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Frequent Visitor

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

This makes perfect sense, I now understand much better.  So if I make an expression that references the datasource directly, like First(Filter(datasource,ID=WorkOrderSelected.ID)) it will update, because then I'm asking it to pull the result from the datasource, not a previously stored variable. 

Thank you for helping me. Incidently, is there a more direct way than First + Filter? If there is a way to avoid a delegation warning that would be ideal.

I'll mark your answer as the solution.

Highlighted
Super User III
Super User III

Re: Gallery does not update after form submits changes/adds entry gallery is displaying

@DCpower 

Yes, that's correct.  When you update the datasource, anything that is directly tied to that will update as well.  Except - variables and collections which have to be executed to "take a snapshot".  But, don't be afraid to go to the datasource as the primary means of getting information.  Many don't realize, but going to the datasource does not mean that you are really going to the actual datasource (i.e. across the wire).  There are a lot of "mechanics" behind a datasource in PowerApps, but suffice to say, it is very similar to a collection all by itself.  So, when you lookup a value, it is really only looking in itself to find it.

With that said...the answer to your First(Filter is Lookup.  Lookup(datasource, ID=WorkOrderSelected.ID) is the same as First(Filter(datsource, ID=WorkOrderSelected.ID))

You should not get a delegation warning on equality to the ID (i.e. ID=something) You will get delgation warnings on any operation or function that cannot be delegated to the datasource.  You would want to read the delegation details for the datasource you are using.  In your case SharePoint.

If you run into delegation issues, first ask yourself it is really important (i.e. do you have more than 2000 records in your datasource that need to be queried?)  If not, then ignore the warning.  If so, then plan around how to achieve a successful query based on your requirements.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (4,438)