Search code examples
powerapps

Adding a custom value to a collection


Hello People Smarter than I am!

I have a power app I have created with drop boxes to filter a gallery. The gallery is filtering properly in my drop box that is based on a collection. My issue is that I cannot get 'ALL' items to show once I invoke the filter on the gallery.

The collection:

ClearCollect(
colJob,
Distinct(RBI_User_Actions_1,BusinessJobTitle)
);

The Drop box:

Sort(colJob,Value)

The visual:

enter image description here

I have been playing around with the following concept from a google search:

ClearCollect(
colJob,{Value:"ALL"}
);

ClearCollect(
colJob,
Distinct(RBI_User_Actions_1,BusinessJobTitle)
);

I have accomplished this in another drop box that has static values that will not change:

["","Incomplete", "1st Follow Up", "2nd Follow Up", "3rd Follow Up", "In Progress (Pending Transfer)","Complete (No Response)", "Complete"]

I unfortunately cannot do this for the previously mentioned drop boxes. Any suggestions are greatly appreciated.


Solution

  • Instead of using ClearCollect on your second call, you should change it to Collect (which doesn't remove the previous elements):

    ClearCollect(
      colJob,{Value:"ALL"}
    );
    
    Collect(
      colJob,
      Distinct(RBI_User_Actions_1,BusinessJobTitle)
    );