web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / lookup() issues with d...
Power Apps
Unanswered

lookup() issues with dynamic values

(0) ShareShare
ReportReport
Posted on by 226 Moderator

Having some problems with lookup() function when trying to build a multi-language supported App.  I have a data source that has 3 columns, Title, English, and French.  When I change the user language from French to English or vice versa I am seeing the desired results.  See examples below.

 

The following code will return just "English" or "French", into the text label.

 

 

LookUp(
 Table2, 
 Text(Dropdown1.Selected.Value) = Text(Column1), 
 varUserLanguage
)

 

 

 

Where this code, returns the proper message or title text from the datasource

 

 

LookUp(
 Table2, 
 Text(Dropdown1.Selected.Value) = Text(Column1), 
 English 
)

 

 

 Yes, I have tried wrapping the varUSerLanguage in Text().

 

I am sure this is a super simple thing I am not seeing.

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Hack-7,

     

    Dynamic column references are currently not supported within Power Apps. A workaround would be using a Switch statement:

    With(
     {
     wRecord: LookUp(
     Table2, 
     Dropdown1.Selected.Value = Column1
     )
     },
     Switch(
     varUserLanguage,
     "English",
     wRecord.English,
     "French",
     wRecord.French
     )
    )

     

    This will make the code rather long. What I would recommend is using a record for each language instead of 1 record with 2 language columns:

     

    Title Language Translation
    Title 1 English English value
    Title 1 French French value

     

    This will allow you to use the following approach instead:

    LookUp(
     Table2, 
     Dropdown1.Selected.Value = Column1 && varUserLanguage = Language, 
     Translation
    )

     

    Additionally, I would not recommend using direct table / list look-ups for translations. Each label would result in an API call and will have a noticable delay within the app (e.g. when navigating screens the text may not be visible yet). You could ClearCollect() all records in e.g. the OnStart to make sure they are accessible in memory and use the collection as your datasource - individual lookups will no longer result in API calls to your datasource.

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • Hack-7 Profile Picture
    226 Moderator on at

    @LaurensM 

     

    Thanks for the notes, I did not realize lookup() did not support dynamic references. 

     

    As a follow-up question.  Would you suggest I build two collections?  One for each language? Or just build a single one that references a language field?  Does it make a difference?

     

    Cheers

  • LaurensM Profile Picture
    12,516 Moderator on at

    @Hack-7,

     

    I would recommend 1 collection with a field to indicate the language. This allows you to reference a simple & short LookUp function (without If / Switch statements). Additionally, this approach is easily scalable with a third language by just adding records (no need to create an additional collection).

     

    One thing to take into account is that using 1 collection expects the list length to not exceed your Data Row Limit (Max 2000 records). Otherwise you may need a workaround to create collections that exceed 2000 records.

     

    I hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard