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 / How to do Set() for Co...
Power Apps
Unanswered

How to do Set() for Combobox whose items is from a LookUp field in Sharepoint List?

(0) ShareShare
ReportReport
Posted on by 107

I have a combobox whose items are from a lookup field in a list.

Items: 

 

 

Choices(SPList.Country)

 

 

 I wanted to set a variable with a lookup() based on a combobox item since I'm going to use that for a switch case.

I tried doing 

 

 

Set(_Country, LookUp(SPList, 'item' = _item, Country))

 

 

or 

 

 

Set(_Country, LookUp(SPList, 'item' = _item, Country).Value)

 

 

but theres an error in the Switch function and_Country returns blank if i used UpdateContext.

 

 

 

Switch(_Country,
"USA",
Set(_rates, _usRate),
"EU",
Set(_rates, _euRate))

 

 

Any help or workarounds is appreciated. 

 

 

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @rzainm 

     

    Try this

     

    Set(_Country, LookUp(SPList, Country = _item).Country)
     
    Switch(_Country,
    "USA", Set(_rates, _usRate),
    "EU", Set(_rates, _euRate)
    )

     

    Thanks!

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation. 

  • rzainm Profile Picture
    107 on at

    Hi @Rajkumar_404 

     

    May I know why Country = _item in the Look up? _item is sort of like the item number.

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    The expression Country = _item in the LookUp function is used to find the record in the SharePoint list where the 'Country' field matches the selected item in the combobox. 

     

    if the combobox items are the names of countries, and the SharePoint list has a field called 'Country' that contains the same country names, the expression Country = _item will find the record in the SharePoint list where the 'Country' field matches the selected item in the combobox.

     

    Thanks!

  • rzainm Profile Picture
    107 on at

    Hello @Rajkumar_404 

    I tried from

    Set(
    _Status,
    LookUp(
    SPList,
    'Entry No.' = _entry,
    Status
    ).Value
    )

    to

    Set(
    _Status,
    LookUp(
    SPList,
    Status = _entry
    ).Status
    )

    It says these types can't be compared "Record" (which is the Status), "Number" (which is the _entry).

     

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    What does the data type of the Country column in SharePoint?

     

  • rzainm Profile Picture
    107 on at

    Country column in SPList is look up type to Countries list. Combo box items is Choices(SPList.Country).

    'Entry No.' column is number type in SP List.

     

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Try this

     

    Set( _Status, LookUp( SPList, Value('Entry No.') = _entry, Status.Value ) )

     

     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard