cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
WaMCHCH
Level: Powered On

CDS linking a field to a column in another entity

Question.PNG

 

Hello,

I have three entities: "Heading", "QuestionList", "Response"

-A question belong to a heading group

-Response has mulitple colum of Question's response of a Yes/No answer.

 

Question: How do I create a relationship so that Response.Q1 know about QuestionList.QuestionNumber. (for querying later on)

[so that if I look at question number 1 I will know all the responses to that question and if I look at Response.Q1 i know the QuestionDescription] I want each column in Response to link to a question number. [Response.Q1 = QuestionList.QuestionNumber 1]

1 REPLY 1
Community Support Team
Community Support Team

Re: CDS linking a field to a column in another entity

Hi @WaMCHCH ,

Could you please share a bit more about your scenario?

Do you want to link the Q1, Q2, Q3, Q4 column in your Response Entity to the QuestionNumber column in your QuestionList Entity?

 

Based on the needs that you mentioned, I afraid that there is no direct way to achieve your needs in PowerApps currently. As an alternative solution, I think the AddColumns function and nested Gallery could achieve yuor needs.

 

I have made a test on my side, please take a try with the following workaround:

Add a Gallery (Gallery1) in your app, set the Items property to following:

AddColumns(
              QuestionList,
              "Q1Response",
              ShowColumns(Response, "EmpID" "Q1"),
              "Q2Response",
              ShowColumns(Response, "EmpID" "Q2"),
              "Q3Response",
              ShowColumns(Response, "EmpID" "Q3"),
              "Q4Response",
              ShowColumns(Response, "EmpID" "Q4"),
)

Then within above Gallery, add a nested Gallery (Gallery2), set the Items property to following:

If(
    ThisItem.QuestionNumber = 1,
    ThisItem.Q1Response,
    ThisItem.QuestionNumber = 2,
    ThisItem.Q2Response,
    ThisItem.QuestionNumber = 3,
    ThisItem.Q3Response,
    ThisItem.QuestionNumber = 4,
    ThisItem.Q4Response
)

Within the Parent Gallery, you could display the QuesitonNumber, QuestionDescription info using some Label controls. Within the nested Gallery, you could display the EmpID, and corresponding Question response info. Please consider take a try with above solution, then check if the issue is solved.

 

More details about adding a nested Gallery in PowerApps app, please check the following video:

https://www.youtube.com/watch?v=ZzQ1t2sQvj8

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 372 members 4,593 guests
Please welcome our newest community members: