cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anton-X
Advocate II
Advocate II

Multi-table Lookups / Polymorphic Lookup - Animal Table [Current Location] Column

Hi,

From the provided spreadsheets, I noticed the [Current Location] column in the Animal table has values from two different source tables.

The values are from both the Shelters table [ShelterID] and Foster Family table [FosterID].

 

Is it a requirement to create a multi-lookup / polymorphic lookup for this? Or will a single line of text column suffice.

 

https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/multitable-lookup 

 

See column image below:

Polymorphic.jpg

 

8 REPLIES 8
bensnow
Frequent Visitor

I ended up not including this field and having a calculated field that just says '@Shelter,@Foster' 

 

I could find no way to combine these.

 

 

From what I've read, it's possible to have two lookups from one column in Dataverse. It was a new feature a few years ago.

But, it can only done using the API via code. Microsoft hasn't built this feature into the UI yet for us no coders.

 

From some research, though, there is a no code workaround option called XrmTool. Worth exploring.

https://www.xrmtoolbox.com/plugins/MscrmTools.PolymorphicLookupCreator/ 

Well, it's confirmed. The xrmtoolbox works. For the 'Current Location' dropdown, I was able to combine the Foster Family and the Shelters in a single dropdown list.

 

PolymorphicLookup.jpg

 

It was tricky to figure it all out. It also added some complexity in the canvas app. You have to use IsType and AsType functions to deal with the fact that your referencing or surfacing column values from two different columns. 

mcofuzor
Frequent Visitor

Hi Anton, please can you give me more details on how you were able to look up both table

Sure @mcofuzor ,

 

I strongly suggest trying this for the first time by creating a test solution and test tables, simulating your animal shelter setup. It's just a weird concept to get your head around. And, you may want to try it a few times first before committing to it.

 

Also important to point out that creating the polymorphic lookup column using this method is 100% no code. I suspect the creator of the xrmToolBox likely made use of the api under the hood though. The tool just feels like an extension of Power Apps.

 

First, you'll need to download the xrmToolbox. I'm pretty sure I didn't need to install it, instead just run the .exe file from the directory you saved it to.

Within the xrmToolBox, you'll be using a specific tool called 'PolyMorphicLookupCreator'

 

You'll use the xrmToolbox to connect to your Power Apps Solution, and will use your Power Up Microsoft login credentials.

 

XrmToolbox3.jpg

 

XrmToolbox4.jpg

 

XrmToolbox2.jpg

 

The Polymorphic lookup creator will do the heavy lifting for you by creating the polymorphic column. It's not created from the Power Apps side.

 

You pick the table you want the column created in, and then pick the related tables. For example, 'Animals' as the main table, and 'FosterFamilies' and 'Shelters' as the related tables.

 

XrmToolbox1.jpg

As soon as you click the 'Create Polymorphic Lookup' button as seen above, a column will be created in your Dataverse solution called 'Current Location'.

 

Linn Zaw Win has a good explanation of the tool's interface.

 

I'm pretty sure when the polymorphic column is created it will utilize the Primary Name columns for the choice value names. So that's something to lookout for. That will depend how you set things up in Power Apps ahead of time.

 

Once the column is created, it will look like a regular lookup column in your column list. The difference being it's looking up two columns from two different tables when you use it.

 

Below is a list of tutorials I collected while learning about this type of column:

https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-references 

https://thepoweraddict.com/how-to-work-with-polymorphic-lookups-in-dataverse/ 

https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/multitable-lookup 

Polymorphic Lookup in Canvas App (youtube)

Tried n' Tested: Embedded Canvas App Part 2 - Gallery and Polymorphic Lookup (youtube.com) 

Multi-table lookups in Microsoft Dataverse - YouTube 

 

Hope that helps get you started.

Anton

@bensnow, how did you do this?

I didn't.

The polymorphic control mentioned by @Anton-X is very impressive but far outside the scope of what the

powerup program is asking for.

 

Instead, I just used the status to control the text of what appeared in that column, so is now just a text field and not linked.

Hi @bensnow, I don't know what you mean by using the status to control the text. I really need a ELI5 version with pictures if you could. 

 

Even to create two separate columns in the Animals table for current shelter or current foster, I can't create lookups to their respective tables. 

 

It seems that in one table, only one column can be a lookup, and for me that is Initial Shelter.  But it makes sense to click on the current shelter/foster information and get their info. I tried watching the power fx video that this program recommended for the location fields, but honestly power fx is just so over my head and I could not comprehend it. 

Helpful resources

Announcements

Important Update | Power Up Community READ ONLY July 22 – July 28

Dear Community Members, As you may have read, the Power Platform communities are transitioning to a new platform and to access will be set to READ-ONLY mode during the transition. Key DatesTo ensure current learners have adequate support in the final week of the cohort, the Power Up Program Community will transition to READ-ONLY mode starting July 22nd, the platform will transition to READ-ONLY mode until July 28th. Power Apps, Power Automate, and Power Pages communities will be read-only July 16-22, 2024.During this period, members will not be able to start new threads or Kudo, Comment, or Reply to any posts, but will be able to search and review past threads or solutions. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. Learners will be able to sign in to the new Power Up Program community experience, starting July 29th. If you registered for community using your learnwithpowerup account, you will not receive an email, but should be able to sign in successfully if you are signed in to My hub.  If you need help with your community account, please submit a request at aka.ms/PPCommSupport We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead! 

Learn what to expect in the Power Up Program

Since its inception in 2022, the Power Up Program has evolved based on feedback from learners and Microsoft Partners and customers. Today's Power Up learners can expect to learn the fundamentals of Microsoft Power Platform in the accelerated seven-week, video-based Power Up Maker course.   Hear from Principal Program Manager, Dimpi Gandhi to discover the latest enhancements and meet the Microsoft MVPs, Rory Neary and Charlie Phipps, who partnered with the Microsoft Power Up Program to create the Power Up Maker course to guide learners to use the Microsoft Power Platform to develop custom applications, build dazzling report dashboards, or create efficiencies through automation.  

Welcome to the Power Up Program Community

The Power Up Program is a free upskilling program where nontechnical people can learn the fundamentals of Microsoft Power Platform. The Power Up Maker course is a seven-week self-paced virtual learning plan that include video-based objectives featuring Power Apps, Power BI and Power Automate.  As a member of the Power Up Community, you can grow your skills and build connections. You can post questions to get help with the curriculum and hands-on exercises from experts and peers in the product boards.  Check out the Community Information & Feedback board to find help or provide feedback with the community experience, and please take time to post in the Social board to tell us more about yourself. If you're new to the Power Up Program and looking for information to register. You can sign up at PowerUp.Microsoft.com.

Users online (1,099)