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

Help w/ Look Up function in two related dropdowns

Hi! 

I'm having trouble connecting two dropdowns to autocomplete eachother in case the user doesn't know one of the datum (Both share the same source in sharepoint), I'm using the look up function as it follows to update one dropdown with the selected item from the other one to autocomplete it, but when I want to apply the same criteria for the other  it marks me an error due to "circular reference", does anyone have an idea as how can I fix it or replace it?

 


Default in dropdown1:

 

LookUp(Directory;PARTY_CODE=DropdownPartyCode.Selected.Title;PAYER_NAME)


Defaut in dropdown2:

 

LookUp(Directory;PAYER_NAME=DropdownPartyName.Selected.PAYER_NAME;PARTY_CODE)

 

For reference:

FORPAPPSFORM.png

 

Thanks in advance

5 REPLIES 5
WarrenBelz
Super User
Super User

HI @GabrielaEsq ,

Absolutely correct - you cannot have controls contents dependant on each other (hence they are a circular reference). You could however do this OnChange of the first box

UpdateContext({varName:Self.Selected.PAYER_NAME})

OnChange of the second box

UpdateContext({varCode:Self.Selected.PARTY_CODE})

Items of the first

Filter(
   Directory;
   PARTY_CODE = varCode;
).PARTY_NAME

Items of the second

Filter(
   Directory;
   PARTY_NAME = varName;
).PARTY_CODE

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi! 

 

Thank you so much for your help , however it did not work 😞 it seems like it does not recognise the variables, could you explain me how does the variables work in the solution that you propose please?

Hi @GabrielaEsq ,

I re-looked at your post - I provided the Items - you want the DefaultSelectedItems (not Default as it does nothing in Combo Boxes) - so it needs to be this

OnChange of the first box

UpdateContext(
   {
      varName:
      LookUp(
         Directory,
         PARTY_CODE = Self.Selected.PARTY_CODE
      ).PARTY_NAME
   }
)

OnChange of the second box

UpdateContext(
   {
      varCode:
      LookUp(
         Directory,
         PARTY_NAME = Self.Selected.PARTY_NAME
      ).PAYER_CODE
   }
)

The DefaultSelectedItems of first box

{PARTY_NAME: varName}

 The DefaultSelectedItems of first box

{PARTY_CODE: varCode}

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @GabrielaEsq ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

GabrielaEsq
Frequent Visitor

Hi! 

 

Yes, thank you , although I ended up using a collection as it follows: 

 

On change:

ClearCollect(PartySelection;Self.SelectedItems)

 

DefautltSelectedItems:

First(PartySelection)

 

Thank you so much for your help! 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,792)