cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

Move checked boxes to the top

This is my filter when a box is checked I want it to stay at the top. When the app is reloaded the previous checkboxes go back to their original placement. The boxes they checked last time are saved and reset to their original positions. How can I bind them to the top so they dont reset when the app is opened back up? Filter(
collCCBMasterData,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) && If(
IsBlank(ComboBox1_1.Selected.Result) || ComboBox1_1.Selected.Result = "All",
true,
'Backlog Status' in ComboBox1_1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
)
,CheckBoxColumn,Descending)

 

This is the default for my checkbox If(
!varChangeFlag,
If(
(ThisItem.Title in collPrevUserVoting.Title || ThisItem.Title in collSelOptions.selName),
true,
false
),
If(
ThisItem.Title in collSelOptions.selName,
true,
false
)
)

26 REPLIES 26

@powerapps890 

Yes, that is correct.  ThisItem will have the extra column in it.  If you try to patch it, you need to either remove it, or use UpdateIf instead.

Do you have a unique ID on your records in the collection? (such as ID)?  Or is there a unique column at all?

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

No should I add a new column to my datasource called ID? And from there do I actually need to number is 1- however many records there are? @RandyHayes 

@powerapps890 

No, it would have just made this next formula MUCH cleaner, but if no unique ID, then we need to do this:

Patch(
    collCCBMasterData,
    First(DropColumns(Table(ThisItem), "cbVal")),
    {CheckBoxColumn:true}
) 

 

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

There are no errors, but it is still not filtering the old answers to the top when I reload the app @RandyHayes 

@powerapps890 

I am not sure what you mean by "old answers"?

In this case you are sorting by the CheckBoxColumn values as they are.

 

Keep in mind that if you have any formulas in the OnCheck or OnUncheck of that checkbox, it IS going to impact your results.  I seem to recall you mentioning that you have some.

If so, you should consider moving them into the OnSelect instead.

The reason is, whatever you are using as the Default for the Checkbox will "check" or "uncheck" based on the Default value AND, if you have OnCheck or OnUncheck formulas they WILL execute.

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

When someone votes it goes to the sharepoint list, when the user reopens the app it pulls their answers from the sharepoint list and each time they submit that new submission overwrites the previous. This is the checkbox default If(
!varChangeFlag,
If(
(ThisItem.Title in collPrevUserVoting.Title || ThisItem.Title in collSelOptions.selName),
true,
false
),
If(
ThisItem.Title in collSelOptions.selName,
true,
false
)
). That is the whole issue..That the old sharepoint answers need to be at the top when the toggle is hit. If it is easier to just save the previous answers at the top without a toggle I could also do that. @RandyHayes I save their old checkbox selections and they are already checked when the user opens up the app the next day.

@powerapps890 

Yes, so you are changing the Value of the Checkbox in the default.  However, the underlying record still has the value you want in it.

So your formula (simplified):

If(!varChangeFlag,
    (ThisItem.Title in collPrevUserVoting.Title || ThisItem.Title in collSelOptions.selName),    
     ThisItem.Title in collSelOptions.selName,
)

How can you avoid changing this value when first viewing?  I don't know what your varChangeFlag or other columns are that you reference, but this seems to be the issue for you.

The fact is, your Gallery is getting filtered and sorted by the CheckBoxColumn properly.  The problem is, your default property on the CheckBox is changing the state of the check.

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

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!

Top Solution Authors
Top Kudoed Authors
Users online (50,404)