cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

@powerapps890 

Please again try changing your formula to the following:

SortByColumns(
    AddColumns(
        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)
        ),
        "CbVal", If(CheckboxColumn, 1, 0)
    )
    "CbVal", Descending
)

This works 100% as mentioned in our other thread.  If it is causing problems then there is some other issue to be resolved.  Particularly, the CheckboxColumn - if that is truly a Boolean column, then this all should work smoothly. 

 

Also, if you still want to apply this with a Toggle, then my other post formula still stands.

 

However, I am not entirely sure what you are trying to do with the Default value on the Checkbox - can you explain as that is different than what you had presented before.

_____________________________________________________________________________________
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!
Highlighted

I am just going to show all related code to help. ClearCollect(collUserVoting,Sort(Filter('CCB Voting','Created By'.Email = varUser.Email),Created,Descending));
Set(varlastSubDate,First(collUserVoting).Date);
ClearCollect(collPrevUserVoting,Filter('CCB Voting','Created By'.Email = varUser.Email And Date = varlastSubDate));
Clear(collSelOptions); - On start
ForAll(collPrevUserVoting,Collect(collSelOptions,{selName:Title}));

Collect(
collSelOptions,
{selName:ThisItem.Title}
);
UpdateContext({varChangeFlag:true}); Patch(collCCBMasterData,ThisItem,{CheckBoxColumn:true}) - This is in both check and uncheckThe default is how the previous answers are saved and loaded in. @RandyHayes I don't know how else to explain

Highlighted

It says it is expecting 2 arguments and still accepting a boolean. I will try anything can I take out the CheckBoxColumn in excel and just create something through powerapps instead. @RandyHayes 

Highlighted

@powerapps890 

Okay, there are typos sometimes!  I had to recreate your scenario in an app to see what is at play.

First, you have two text inputs called Filter and Search.  I would immediately rename them as those are going to conflict with built-in functions.  So, Filter becomes txtFilter and Search becomes txtSearch.

Now this formula...

SortByColumns(
    AddColumns(
        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(txtFilter.Text), true, txtFilter.Text in 'Requirement Source') && 
            
            If(IsBlank(txtSearch.Text), true, txtSearch.Text in Name)
        ),
        "CbVal", If(CheckboxColumn, 1, 0)
    ),
    "CbVal", Descending
)

 

Beyond that, there was only a comma missing in the last formula I gave 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.
Check out my PowerApps Videos too!
Highlighted

I am still getting the same error expecting a boolean @RandyHayes 

Highlighted

@powerapps890 

Yes, so this is saying that your Checkbox field is NOT being seen as a Boolean.

To be certain, you DO have a Checkbox field in your data collection?  You mentioned this came from your Excel sheet?

 

I have the same setup now here with a "made up" datasource to mimic what you are seeing.  The Checkbox field in my collection IS a Boolean, and it is just fine.  So, please review your Checkbox column in your Excel file.  If it is being brought in as Text, then change the formula to this:

SortByColumns(
    AddColumns(
        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(txtFilter.Text), true, txtFilter.Text in 'Requirement Source') && 
            
            If(IsBlank(txtSearch.Text), true, txtSearch.Text in Name)
        ),
        "CbVal", If(CheckboxColumn="true", 1, 0)
    ),
    "CbVal", Descending
)
_____________________________________________________________________________________
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!
Highlighted

That is causing the oncheck and uncheck to not work. I don't have a checkbox column collection.. It is just a column heading in an excel sheet. @RandyHayes 

Highlighted

@powerapps890 

Yes, I understand it is a column in your Excel file.  The issue is that many times PowerApps will read a (seemingly) true/false Boolean column as a text column.  If it is, then applying Boolean logic on it will not work.

 

If you put a simple Label on the screen and set the Text to First(colCCBMasterData).CheckboxColumn you will see in the formula editor that it will tell you the data type of that Checkbox.

Please make sure it shows Boolean if it shows Text then PowerApps is seeing that column as text and we need to work with it as such.

_____________________________________________________________________________________
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!
Highlighted

Nevermind the name was wrong because I copied it. There is no error now, it is just blank@RandyHayes 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,961)