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

Filter Default view

Hello,

 

I recently tried to implement archive in my app using status field onSuccess form - it worked correctly - after changing the status it was copying a record from one sharepoint list to another and then deleting it.

I thought that this is efficient but it has a serious flow - attachments and server generated fields cannot be copied so such a solution was unacceptable for me (I know that I can use custom fields and copy author + created field to them, but attachments without a complex flow won't be achieved).

 

So I gave up on that and thought that I should change my gallery view and status dropdown filter to "hide" propositions with certain status, and show them on a different gallery. This way I could create archive.

 

With some help of people I created o good dropdown filter with Item properties:

 

Filter(
    Choices([@IdeaBox_1].Status),
    !(Value in ["Zrealizowana","Odrzucona"])
)

This shows all possible status field except Rejected/Done.

This is a first step to make a gallery filter well since I wanna hide Rejected/Done status by default.

 

The harder part is this huge filter on gallery:

Sort(Filter(Search(AddColumns(IdeaBox_1,"AuthorName",'Utworzone przez'.DisplayName,"CategoryCombo",Status.Value,"WhoChanged",'Zmodyfikowane przez'.DisplayName),SearchBox_1.Text,"Nazwa","Opis","AuthorName","WhoChanged"),

(If(IsBlank(Last(FirstN(ComboBox2_1.SelectedItems.Value,1)).Value),true, Last(FirstN(ComboBox2_1.SelectedItems.Value,1)).Value in Status.Value)||
If(IsBlank(Last(FirstN(ComboBox2_1.SelectedItems.Value,2)).Value),true, Last(FirstN(ComboBox2_1.SelectedItems.Value,2)).Value in Status.Value)||
If(IsBlank(Last(FirstN(ComboBox2_1.SelectedItems.Value,3)).Value),true, Last(FirstN(ComboBox2_1.SelectedItems.Value,3)).Value in Status.Value)||
If(IsBlank(Last(FirstN(ComboBox2_1.SelectedItems.Value,4)).Value),true, Last(FirstN(ComboBox2_1.SelectedItems.Value,4)).Value in Status.Value))

&&(Utworzony) >= DatePicker1_2.SelectedDate && (Utworzony) <= DatePicker2_2.SelectedDate +1), Utworzony, If(SortDescending2,Descending,Ascending))

 

This dropdown (ComboBox2_1) works like that "include ||" I can select up to 4 choices that should be visible in this gallery - the one that are not hidden).

I also have a DatePicker that can filter through two dates, and an input field that filter through a lot of data.

And on top of that a button with ascending descending created date.

 

Is there a way add another filter that would hide all records that has a value in combobox "Rejected" and "Done".

Could anyone guide me where to add this in my function to not mess up with rest of filters?

 

I believe that this filter should have a highest priority and rest should be nested/accounted after this.

 

After I create this I will copy this function to add another gallery that would print only propositions with "Done" and "Rejected" and this way I will have fully functional archive and also I will save my app from 500-2000 limit since the records will be split in a great numbers.

 

Thank you in advance for your help.

16 REPLIES 16
Highlighted

@RandyHayes 

Randy I noticed a weird behaviour with your first two functions.

They shows 0 record now matter what status I pick.

But when I uncheck all status values and leave Combox2_1 empty then records are shown.

 

And when I refresh Combox2_1 no records are showed again.

 

I tried changing status from this:

Filter(
    Choices([@IdeaBox_1].Status),
    !(Value in ["Zrealizowana","Odrzucona"])
)

to this:

Choices([@IdeaBox_1].Status)

 

So somehow formula got a problem with initial filter...

 

ComboBox got DisplayFields and Search filled with:

["Value"]

 

I found only one workaround to make it work - filling DefaultSelectedItems - but it is bugged as hell.

 

 

Highlighted

@Elitezone 

Your formula for the Items property of the ComboBox is fine.

You would only set the DefaultSelectedItems if you want there to be values selected by default.  I don't believe you need that in this case.

 

I re-reviewed the formula based on what you mentioned the behavior is now.  As expected, when nothing is selected in the combo, you get results.  Based on that I noticed I had a ".Value" missing in the formula.

SO...formula should be this:

Sort(
    Filter(
        Search(
            AddColumns(IdeaBox_1,
                "AuthorName", 'Utworzone przez'.DisplayName,
                "CategoryCombo", Status.Value,
                "WhoChanged", 'Zmodyfikowane przez'.DisplayName
            ),
            SearchBox_1.Text, "Nazwa", "Opis", "AuthorName", "WhoChanged"
        ),
        
        (CountRows(ComboBox2_1.SelectedItems)= 0 || CategoryCombo in ComboBox2_1.SelectedItems.Value) &&
        !(CategoryCombo in "Rejected|Done") &&
        Utworzony >= DatePicker1_2.SelectedDate && 
        Utworzony <= (DatePicker2_2.SelectedDate +1)
     ), 
     Utworzony, 
     If(SortDescending2,Descending,Ascending)
 )

 

See if that improves 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.
Check out my PowerApps Videos too!
Highlighted

@RandyHayes 

Still shows gallery default with 0 records - when I pick status combobox once and later clear it manually by unselecting choices in combobox - it shows all records.

However when I use refresh function it shows 0 records again.

 

All works except this initial gallery load and I have no idea why ;(

Highlighted

@Elitezone 

I'm not entirely sure what you are referring to with "refresh".  There shouldn't need to be any refreshes for this.

 

Can you post your current formula for the Items property so I can double check where things are?

_____________________________________________________________________________________
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

@RandyHayes 

Sort(
    Filter(
        Search(
            AddColumns(IdeaBox_1,
                "AuthorName", 'Utworzone przez'.DisplayName,
                "CategoryCombo", Status.Value,
                "WhoChanged", 'Zmodyfikowane przez'.DisplayName
            ),
            SearchBox_1.Text, "Nazwa", "Opis", "AuthorName", "WhoChanged"
        ),
        
        (CountRows(ComboBox2_1.SelectedItems)= 0 || CategoryCombo in ComboBox2_1.SelectedItems.Value) &&
        !(CategoryCombo in "Odrzucona|Zrealizowana") &&
        Utworzony >= DatePicker1_2.SelectedDate && 
        Utworzony <= (DatePicker2_2.SelectedDate +1)
     ), 
     Utworzony, 
     If(SortDescending2,Descending,Ascending)
 )

 

Randy by Refresh I mean that I use button to RESET all filters/datapickers etecera.

Formula:

 

Refresh(IdeaBox_1);Reset(DatePicker1_2);Reset(DatePicker2_2);Reset(SearchBox_1);Reset(ComboBox2_1);Reset(Gallery2_1)

 

Scenario:

1. When you load gallery screen you see 0 records.

2. When you pick a value in ComboBox2_1 it starts showing results.

3. When you unpick all choices in ComboBox2_1 it shows ALL results.

4. When you use Reset button it shows 0 records again and you need to do steps 1,2,3 again 😉

Highlighted

@RandyHayes 

Randy I believe that I have fixed this function (wow - I am so proud of myself).

 

Sort(
    Filter(
        Search(
            AddColumns(IdeaBox_1,
                "AuthorName", 'Utworzone przez'.DisplayName,
                "CategoryCombo", Status.Value,
                "WhoChanged", 'Zmodyfikowane przez'.DisplayName
            ),
            SearchBox_1.Text, "Nazwa", "Opis", "AuthorName", "WhoChanged"
        ),
        
        (CountRows(ComboBox2_1.SelectedItems)= 0 || IsBlank(ComboBox2_1.SelectedItems) || CategoryCombo in ComboBox2_1.SelectedItems.Value) &&
        !(CategoryCombo in "Odrzucona|Zrealizowana") &&
        Utworzony >= DatePicker1_2.SelectedDate && 
        Utworzony <= (DatePicker2_2.SelectedDate +1)
     ), 
     Utworzony, 
     If(SortDescending2,Descending,Ascending)
 )

From what I understand the problem occured because when gallery was initially loaded this function (CountRows(ComboBox2_1.SelectedItems)= 0 did not return 0, because there was no value in ComboBox2_1.

I added validation IsBlank(ComboBox2_1.SelectedItems) and now it works great.

 

Gallery is loaded initially with all records, and ComboBox2_1 works perfectly.

Can you just check if I thought correctly ;)?

 

Thanks for all your help.

Highlighted

@Elitezone 

Yep...that was what I was honing in on with our troubleshooting.  Sorry for the delay, but it looks like that afforded you some time to hash it out.  🙂

_____________________________________________________________________________________
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
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 (8,532)