Search code examples
azure-sql-databasepowerapps

Microsoft Powerapps, Filter out based on column data


I have a Powerapp pulling data from a SQL database. The function on the Browser gallery is the following to return all entries:

SortByColumns(Search([@'[dbo].[orders]'], TextSearchBox1.Text, "name_last","contact_email","contact_sms","name_first"), "check_in", If(SortDescending1, Descending, Ascending))

I need to filter in / out entries based on the following:

  1. check_in is not Null AND
  2. is_complete = 0

How can this be done with the code above?

Thanks for answering a n00b question :)


Solution

  • Just like you are combining the Search and SortByColumns in your example, you can also combine other functions, like Filter, in your expression, like in the example below:

    SortByColumns(
        Search(
            Filter(
                [@'[dbo].[orders]'],
                !IsBlank(check_in),
                is_complete = 0),
            TextSearchBox1.Text,
            "name_last",
            "contact_email",
            "contact_sms",
            "name_first"),
        "check_in",
        If(SortDescending1, Descending, Ascending)))