1

First time asking a question here. As well as being pretty new to PowerApps as well. I am trying to use two text input boxes for the user to define the min & max of their number range. basically i want the code to return all results that fall in the user defined range. User inputs are: SearchText.Text MinSearch.Text and MaxSearch.Text PDFData is the table, and RMANumber is the column that i want the Min & Max to search and return all within the user defined range. as of now, all i can get this to return are exact results, which just won't work for my situation. In my way of thinking, i want to add WHERE after the RAWidth and give greater or lesser arguments, but this isn't working for me. My full code is below, and any help is appreciated.

If(SearchText.Text="" && MinSearch.Text="" && MaxSearch.Text="", PDFData, Filter(PDFData,SearchText.Text in PDFAuthor|| SearchText.Text in PDFName|| SearchText.Text in RMANumber|| MinSearch.Text in RAWidth))

1 Answers1

0

You can use the following expression for your query:

Filter(
    PDFData,
    SearchText.Text in PDFAuthor || SearchText.Text in PDFName,
    Coalesce(Value(MinSearch.Text), -1) <= RAWidth,
    Coalesce(Value(MaxSearch.Text), 1000000000) >= RAWidth)

If the SearchText is empty, then the conditions SearchText.Text in PDFAuthor and SearchText.Text in PDFName will both be true anyway, so there's no need for the If at that point.

For the other conditions, we can use the functions Value / Coalesce to convert the text input to a number; if the user didn't enter anything (or entered an invalid number), then the function Value will return a blank value, and the Coalesce function will use the next value. I'm using here -1 for the minumum value and 1000000000 for the maximum - if the possible range of values in your RAWidth column is between those numbers then you're fine.

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171
  • Thank you! This is exactly what i needed and now i can move froward in my project. I did keep in the `If` statement though. It seems if i removed it, then i would get an "Unexpected token" error. `If(SearchText.Text="" && MinSearch.Text="" && MaxSearch.Text="", PDFData, Filter( PDFData, SearchText.Text in PDFAuthor || SearchText.Text in PDFName, Coalesce(Value(MinSearch.Text), -1) <= RAWidth, Coalesce(Value(MaxSearch.Text), 500) >= RAWidth))` This is my new, complete code that is working perfectly. Many Thanks! – Robert Werner Apr 17 '18 at 15:48