Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  How to avoid displaying repeated data in a gallery

    Posted Dec 01, 2022 01:21 PM

    have a gallery in which I am showing data from a dropdown, when selecting an item from the dropdown the gallery is loaded with the corresponding data.

     To display the data in the gallery I make use of the Items property in which I make use of the following formula:

    Filter(
    'Warehouse';
    'RecordAssigment'.Id_record = Dropdown1.Selected.Result;
    StartsWith(
    'Description ';
    TextInput1.Text
    )
    )
    What I want to avoid is that repeated data is displayed in my gallery, the following is an example of the data list, I want to avoid showing repeated data such as "Germanyor "Spain".

    Description: "United Kingdom",
    Description: "Germany",
    Description: "Spain",
    Description: "Germany",
    Description: "Spain",
    Description: "Germany"
    I tried adding the Distinct function to the Items property of the Dropdown, but it didn't work.
     
    Distinct('Warehouse';'RecordAssigment'.Id_record)
    Someone knows that another function I can use to prevent the data from repeating.

     



    ------------------------------
    John Doe
    ------------------------------


  • 2.  RE: How to avoid displaying repeated data in a gallery

    Posted Dec 04, 2022 08:22 PM
    Hi John,

    Have you tried wrapping the Filter in the Distinct?

    Distinct(
    Filter(
    'Warehouse';
    'RecordAssigment'.Id_record = Dropdown1.Selected.Result;
    StartsWith(
    'Description ';
    TextInput1.Text
    )
    )
    )


    ------------------------------
    Tom Woodhill
    Principal Governance Officer
    Brisbane
    ------------------------------



  • 3.  RE: How to avoid displaying repeated data in a gallery

    Top Contributor
    Posted Dec 13, 2022 03:45 AM
    Hi John,
    Apologies for the "code gymnastics" here, but if you want all your list back, while getting distinct values (and maintaining some form of Delegation on the exercise), one way is to split it up as below. Note that the top filter (wList) needs to output record numbers under your Delegation Limit (Distinct also has this limitation) for you to get all the records
    With(
       {
          wList:
          Filter(
             'Warehouse';
             'RecordAssigment'.Id_record = Dropdown1.Selected.Result &&
             StartsWith(
                'Description ';
                 TextInput1.Text
             )
          )
       };
       With(
          {
             wGroup:
             AddColumns(
                GroupBy(
                   wList;	           
                   "Description";
                   "Data"
                );
                "ID1";
                First(Data).ID
             )
          };
          Filter(
             wList;
             ID in wGroup.ID1
          )
       )
    )​


    ------------------------------
    Warren Belz
    MVP (Business Applications)
    Australia
    ------------------------------