cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cyril
Frequent Visitor

Lookup with two dropdowns

Hi!

 

I have imported this table "Anrede" (static excel import):

 

ID                              Deutsch                           Francais                   Italiano

mSehr geehrter HerrCher MonsieurCaro Signore
fSehr geehrte FrauChère Madame Gentile Signora

 

Now I have to radio-buttons:

  • rdo_lang, with Items=[“Deutsch”,”Francais”,”Italiano”]
  • ​rdo_gender, with Items=Anrede.ID

 

 

Depending on those radios, I want the corresponding String from the table. Example: rdo_lang =”Deutsch” and rdo_gender =”f”, I want the string “Sehr geehrte Frau” as result in a textfield.

 

I try with Lookup in the textfield, but this is not working:

 

 

LookUp(
    Anrede,
    ID = rdo_gender.SelectedText.Value,
    rdo_lang.SelectedText.Value
)

 

 

 
 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@cyril 

Sorry, just looking at your original post (and my reply) - Your formula should be this:

With({_itm:  LookUp(Anrede, ID = rdo_gender.Selected.ID)},
    Switch(rdo_lang.Selected.Value,
        "Deutsch", _itm.Deutsch,
        "Francais", _itm.Francais,
        "Italiano", _itm.Italiano
    )
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

8 REPLIES 8
RandyHayes
Super User III
Super User III

@cyril 

Please consider changing your Formula to the following:

With({_itm:  LookUp(Anrede, ID = rdo_gender.Selected.Value)},
    Switch(rdo_lang.Selected.Value,
        "Deutsch", _itm.Deutsch,
        "Francais", _itm.Francais,
        "Italiano", _itm.Italiano
    )
)

This assumes that you only have one row in your list that matches the gender.

Also, avoid using SelectedText as it is a deprecated property.  The above formula uses the Selected property.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
cyril
Frequent Visitor

Thanks for your fast response! Are you shure SelectedText is deprecated in radio buttons? Because with your suggestion it throws an error "invalid argument". With SelectedText it doesn't?

 

RandyHayes
Super User III
Super User III

@cyril 

Yes, from the Docs for Radio controls:

RandyHayes_0-1612825622511.png

 

If it shows invalid, then what is the Items property of the Radio control?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
RandyHayes
Super User III
Super User III

@cyril 

Sorry, just looking at your original post (and my reply) - Your formula should be this:

With({_itm:  LookUp(Anrede, ID = rdo_gender.Selected.ID)},
    Switch(rdo_lang.Selected.Value,
        "Deutsch", _itm.Deutsch,
        "Francais", _itm.Francais,
        "Italiano", _itm.Italiano
    )
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

cyril
Frequent Visitor

I just figured out, that the problem is only with the rdo_gender! There Items look like this.

cyril_0-1612825775878.png

I don't know why, but this is working:

With({_itm:LookUp(Anrede; ID = rdo_gender.Selected.ID)};
    Switch(rdo_lang.Selected.Value;
        "Deutsch"; _itm.Deutsch;
        "Francais"; _itm.Francais;
        "Italiano"; _itm.Italiano
    )
)

 

RandyHayes
Super User III
Super User III

@cyril 

Yes, we must have cross replied...

Selected is ALWAYS based on the properties of the records of the Items property.  In your case, you have the items set to the ID, so the Selected will be .ID.

In the language radio, you have the items set to a table with a single column called value  

[“Deutsch”,”Francais”,”Italiano”]

The above is a single column table with a Value column.  It is equivalent to:

Table({Value:“Deutsch”}, {Value:”Francais”}, {Value:”Italiano”})

PowerApps let's us shortcut with the square brackets.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
cyril
Frequent Visitor

Thank you so much for your explanation and solution!

RandyHayes
Super User III
Super User III

@cyril 

Always happy to help!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,594)