Search code examples
powerapps

Lookup always return first item


I have one dropdown, DataCardValue9, with "Fournisseur" in Items. I can choose which "Fournisseur" I want. Working. I have several labels, with :

LookUp(Fournisseur;DataCardValue9.Selected.Title in Fournisseur.Title;Ville)

So, I'm trying to find address, city, numbers... from my fournisseur in the dropdown. Title are unique in Fournisseur. So, why the result is always the first line, instead of the line with "DataCardValue9.Selected.Title in Fournisseur.Title" ?

Thanks.


Solution

  • You probably want to have this expression:

    LookUp(Fournisseur; Title = DataCardValue9.Selected.Title; Ville)
    

    The expression inside the LookUp function works in the context of the data source of the first parameter. If you want to compare with the Title column in a single row, you just specify Title.

    When you specify Fournisseur.Title, since there's no Fournisseur column in your Fournisseur table, that expression is interpreted as "all values of the Title column in the Fournisseur table. And since the selected title from the dropdown comes from the same data source, that expression will be true for all items in the table. When LookUp results in multiple items, it will take the first one, which is what you're observing.