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

Flagging a Parent BrowseGallery if a checkbox in the child DetailScreen is updated

Good day. I have two questions.

I have a browsegallery which is connected to an SQL db table. When navigating to the Detail screen I have added in some date boxes which are updated with new dates, then using a button these new dates are passed to a flow. e.g ETA in the db = 28/11/20 but the correct date is 29/11/20 then operator updated the date box and clicks submit.

Fi question: I need to mark this updated record as having been updated so I have added a check box into the detail screen which I thought I'd update using the same update button but can not seem to get the updatecontext to work. Here is what I have added to the onselect box ;UpdateContext({CheckBox3:true}) . I have tried placing the checkbox in one of the cards as well as the screen. Any ideas as to why this is not working?

Second question, assuming that I can get this to work how do I then display the check box on the main screen so that the operator knows that they have updated the record. This only needs to be shown during a single run through of the records i.e. after a refresh of the data everything can return to default. If there is a better way to do this I'd love to know about it.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Garethterb 

First, you cannot change a control property like that.  Everything in PowerApps is Formula based and by reference.  So, you don't set a checkbox to true or false, instead, the Default property of the checkbox needs to reference something that will make it be true or false.

If you changed your OnSelect to the following:  UpdateContext({lclCheck:true}) and then set the Default property on the Checkbox to lclCheck then you will see the checkbox turn true when your button is clicked.

 

HOWEVER, your bigger issue is going to come when you want this back in your Gallery.  If your Gallery is based on just a DataSource, then there is no way you can get this information back to the Gallery.

 

One thing you can do is to build a side-line collection.  So, on your OnSelect of the button, set the formula to the following.  (NOTE: This assumes you have a unique ID column in your datasource.  If it is not called ID, then change to whatever column name provides a unique identification):

     Collect(colChecks, {ID: theIDColumnOfTheRecordYouAreEditing})

If your Detail screen is a form, then you can use the referencing ID from that form (I'd need to know more about how you are getting information on your detail screen to offer more detail)

 

For the Checkbox on the Detail screen, set the Default property to : theIDColumnOfTheRecordYouAreEditing in colChecks.ID

 

Now in your Gallery, if you put a checkbox there (or something else to indicate), then set the Default property to the following:  ThisItem.theIDColumnOfTheRecord in colChecks.ID

 

This will give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

2 REPLIES 2
RandyHayes
Super User III
Super User III

@Garethterb 

First, you cannot change a control property like that.  Everything in PowerApps is Formula based and by reference.  So, you don't set a checkbox to true or false, instead, the Default property of the checkbox needs to reference something that will make it be true or false.

If you changed your OnSelect to the following:  UpdateContext({lclCheck:true}) and then set the Default property on the Checkbox to lclCheck then you will see the checkbox turn true when your button is clicked.

 

HOWEVER, your bigger issue is going to come when you want this back in your Gallery.  If your Gallery is based on just a DataSource, then there is no way you can get this information back to the Gallery.

 

One thing you can do is to build a side-line collection.  So, on your OnSelect of the button, set the formula to the following.  (NOTE: This assumes you have a unique ID column in your datasource.  If it is not called ID, then change to whatever column name provides a unique identification):

     Collect(colChecks, {ID: theIDColumnOfTheRecordYouAreEditing})

If your Detail screen is a form, then you can use the referencing ID from that form (I'd need to know more about how you are getting information on your detail screen to offer more detail)

 

For the Checkbox on the Detail screen, set the Default property to : theIDColumnOfTheRecordYouAreEditing in colChecks.ID

 

Now in your Gallery, if you put a checkbox there (or something else to indicate), then set the Default property to the following:  ThisItem.theIDColumnOfTheRecord in colChecks.ID

 

This will give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

That was a great help thanks.

I ended up changing things a little. I ditched the tick box at the lower level and put one on the gallery which is then controlled by the ID being in the collection.

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (91,365)