Search code examples
powerapps

PowerApp Rules to return boolean if collection contains a string value


I have a collection called Records and I want to see if I can return true if the collection contains a specific string.

The idea I had was to hide a button if the title of that selected item is in the collection. The selected item is pulled off from my SharePoint list.

I was hoping I could use something like this:

if (Count(LookUp(Registered, BrowseGallery1.Selected.Title = Title)) > 0, true, false)

This doesn't work because Count expects to have a table passed to it and my lookup returns records.

Any ideas how I can get this working or pointers?

Thank you.


Solution

  • Found the solution - hopefully this helps others.

    We need to set a condition on the "Visible" property of a button. So, first step is to make sure you are adding the following formula to the visible property.

    IsBlank(LookUp('Registered', Course_x0020_Registered_x0020_To = ThisItem.Title).Course_x0020_Registered_x0020_To)
    

    In the above code:

    • 'Registered': Name of the table I want to look into
    • Course_x0020_Registered_x0020_To: The column in the Registered Table
    • ThisItem.Title: ThisItem is provided by the BrowserGallery control. I am asking for the Title of the selected item

    IsBlank returns no values (blank) from the Lookup - and so the returned values will be true or false. If the Lookup is blank, it means no matches were found.