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

Prefill dropdown using lookup

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?

 

 

10 REPLIES 10
cwebb365
Super User
Super User

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. 

apkoh18
Frequent Visitor

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.

 

 

 

 

 

 

 

***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: ""

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. 

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. 

v-bofeng-msft
Community Support
Community Support

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

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.

 

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
Frequent Visitor

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.....

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,886)