Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Prefill dropdown using lookup

(0) ShareShare
ReportReport
Posted on by 9

Hi All

 

I am waiting to prefil a drop down list that is connected to SharePoint List (eg PeopleList) using a lookup from another list SourceList.

IDValueColumnPersonColumn
1Value1Person1

 

PeopleList:

Person
Person1
Person2

 

 

 

LookUp('SoureList',ID= Value(ValueCard_DataCardValue.Selected.Id),'PersonColumn')

 

So when i chose Value1, in ValueCard. Person1 from the same row in SourceList is show in PersonCard.

 

Is this possible?

 

 

Categories:
  • Re: Prefill dropdown using lookup

    Hi @apkoh18 ï¼š

    The point is that DefaultSelectedItems should be items in the combo box's data source.Your combo box's source is PersonList , but  DefaultSelectedItems is a text type value which is not a record in PersonList. You'd better try:

    With(
     {
     ThePerson:LookUp('IFM Approver 1_1',Approver1.DisplayName=(LookUp('Bank Accounts_1',ID=Value(FromAccountNumber_DataCardValue.Selected.Id),DefaultApprover.DisplayName)),Approver1.Email)
     },
     LookUp(PesrsonList,xxx=ThePerson)
    )

    Best Regards,

    Bof

  • apkoh18 Profile Picture
    apkoh18 9 on at
    Re: Prefill dropdown using lookup

    Hi All

     

    If i were to use a text input: this works:

    LookUp('IFM Approver 1_1',Approver1.DisplayName=(LookUp('Bank Accounts_1',ID=Value(FromAccountNumber_DataCardValue.Selected.Id),DefaultApprover.DisplayName)),Approver1.Email)

     

    But it does not work when added to DefaultSelectedItems to the DropDown combo box.

     

    Im not sure if it's possible.....

  • Re: Prefill dropdown using lookup

    Hi @apkoh18 :

    Maybe you could try:

    With(
     {SelectedID:Value(ValueCard_DataCardValue.Selected.Id)},
     LookUp(
     YourCollection,
     Person.DisplayName=LookUp(
     'SoureList',
     ID=SelectedID,
     'PersonColumn'
     ).DisplayName
    
     )
    )

    Best Regards,

    Bof

  • apkoh18 Profile Picture
    apkoh18 9 on at
    Re: Prefill dropdown using lookup

    Hi Bof

    1) PersonColumn in SourceList is of Person type

    2) Person in PeopleList is also of Person type

    3) Drop down control

    4) Yes

    5) Correct, it is using a Collection based on People List

    6) Yes

     

    Thanks

     

    It's gave me warning, that lookup might work on larger data sets.

     

    But this did not fix the issue.

     

    Thank you too for assisting me with this.

     

  • Re: Prefill dropdown using lookup

    Hi @apkoh18 :

    Could you please tell me:

    1\Is PersonColumn a person type column which allow multiple selections? I assume it do not allow multiple selections.

    2\What is Person( in PeopleList) 's date type? I assume it is a text column.

    3\What is the dropdown you mentioned?Is it a combo box control or a dropdown control?I assume it is a combo box control.

    vbofengmsft_0-1635314736933.png

    4\Does the Person column in PeopleList store the user's DisplayName?

    5\What is the dropdown/combo box's items property?I assume it is 

    PeopleList

    6\Do you want to set the dropdown/combo box's default items to be the person which is selected by ValueCard_DataCardValue? If so please set the combo box's DefaultSelectedItems property to:

    LookUp(
     PeopleList,
     Person=LookUp(
     'SoureList',
     ID= Value(ValueCard_DataCardValue.Selected.Id),'PersonColumn'
     ).DisplayName
    
    )

    Best Regards,

    Bof

  • cwebb365 Profile Picture
    cwebb365 3,294 on at
    Re: Prefill dropdown using lookup

    Ok after re reading the issue, it seems that's what you actually need. In the Person control / list use LookUp('SoureList',ValueCard_DataCardValue.Selected.PersonColumn.Email = PersonColumn.Email) That should be the match you are looking for there. 

  • cwebb365 Profile Picture
    cwebb365 3,294 on at
    Re: Prefill dropdown using lookup

    I still don't think I understand the need, you're saying there is a 3rd list now involved? Can you just please list your controls, and datasources you are trying to filter? It should just be an easy filter based on something like personcolumn.email = selected.personcolumn.email etc. but I'm confused a bit still, sorry. 

  • cwebb365 Profile Picture
    cwebb365 3,294 on at
    Re: Prefill dropdown using lookup

    ***Edit, after studying problem statement this likely will not help in this case, but it is used to Set / Match SharePoint people column values. 

     

    You'll have to utilize this format to default to a person field with the 3 lookups to your selected item returning the 3 fields. That should get you the default match. 

     

    {
    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "i:0#.f|membership|"& lookup(datasource,ID = dropdown.selected.id).Email,
    Department: "",
    DisplayName: lookup(datasource,ID = dropdown.selected.id).displayName,
    Email: lookup(datasource,ID = dropdown.selected.id).email,
    JobTitle: "",
    Picture: ""

  • apkoh18 Profile Picture
    apkoh18 9 on at
    Re: Prefill dropdown using lookup

    Hi, thank you for responding.

     

     

    The drop down has a data collection with a defined list (different list from SourceList) of names using the Person column type.

     

    I have tried adding a Person type column in the SourceList. This person column is the "default" choice for this value in the source list.

     

    This default value should populate the drop down based on the value I've chosen in another data card.

     

    The formula does not produce any errors, but it does not produce the desired result - hence the post.

     

     

     

     

     

     

     

  • cwebb365 Profile Picture
    cwebb365 3,294 on at
    Re: Prefill dropdown using lookup

    Yeah, that formula should work. Need a bit more information about what the controls you're trying to populate are, but the idea is, you have a list of items or drop down, with the items being the entire list or a filter() items in the drop down. Then when you select it, the "Item" property if it's a gallery should either be a filter if multiple items, or a lookup() if one. If it's just a static control with labels / pictures etc. then you can use the lookup() to return to the "Text" or "image" etc. properties to show what you need in those controls. 

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard