powerappspowerapps-canvaspowerapps-formula

Power Apps Sees A SQL Item That's Not There


In PowerApps, I'm checking to see if a "BookCode" is in SQL (Column: 'Book Number').

     Not(IsBlank(Filter(BookDatabase,ThisItem.BookCode='Book Number')))

However, PowerApps is seeing an item that isn't in SQL(?)

In the image below, blue is my PowerApps Gallery, 'true' is a label with the formula above, and the white square is the SQL DB (BookDatabase) sorted by 'Book number'.

enter image description here


Solution

  • The Filter function does not return a blank table for that value - it returns an empty table, but it is not blank.

    You can update your expression to either of those:

    Not(IsEmpty(Filter(BookDatabase, ThisItem.BookCode = 'Book Number')))
    

    or

    Not(IsBlank(LookUp(BookDatabase, ThisItem.BookCode = 'Book Number')))
    

    Since the LookUp function returns a blank record if none is found.