powerapps

How to combine Filter and Sort in powerapps FX for items


I have simple app where I trying to display filtered data and I want to sort by Title column, those A and B lines in FX windows works OK separately, how I can combine them ? I tried to nest it into one into another, that didn't work.

Please refer to pic below with all details, it's canvas app with table in container. Thanksenter image description here


Solution

  • Simple Example

    Sort(
        Filter(candcollect,PositionId=PositionGallery.Selected.Id),
        CandidateName,
        SortOrder.Ascending
    )
    

    Example from Sample Inventory Management Application, where Products can be searched and sort. If value provided in ProductSearchBox then it will be filtered and then Sort in descending order.

    If(First(StoreInventory).Value="All",
        Filter(Products,ProductSearchBox.Text in ProductName),
        First(StoreInventory).Value="Stock",  
            Sort(Filter(Products,ProductSearchBox.Text in ProductName&&DefaultSellingQuantity>0), 
            If((DefaultSellingQuantity)/Value(Stock)*100>70,
                "a", 
                (DefaultSellingQuantity)/Value(Stock)*100>=31&&(DefaultSellingQuantity)/Value(Stock)*100<=70,
                    "b",
                (DefaultSellingQuantity)/Value(Stock)*100>=1&&(DefaultSellingQuantity)/Value(Stock)*100<=30,
                    "c", 
                DefaultSellingQuantity=0, 
                    "d"), 
        SortOrder.Descending))
    

    Another Example from Property Management Application

       Sort(
          Filter(TenantCollect,TenantSince<Today()),
        FirstName,
        SortOrder.Ascending)