cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Chandu Helper II
Helper II

How to Join two Tables with common Unique ID in DisplayForm. So, that all fields from both the tables must be visible in that DisplayForm.

I am Having 2 tables in SQL Server like:

Table1: PROJECT_DATA(PROJECT_ID, CUSTOMER_NAME, PROJECT_NUMBER), where PROJECT_ID is Auto-Generate ID

Table2: TASK_DATA(TASK_ID, PROJECT_ID, TASK_NUMBER, MOTOR_DETAILS, TEST_DATE), where TASK_ID is Auto-Generate ID
Now, In Screen1, I am Saving EDITFORM1 where its Datasource Property is set to PROJECT_DATA(CUSTOMER_NAME, PROJECT_NUMBER) Table.

In Screen2, I am Saving EDITFORM2 where its Datasource Property is set to TASK_DATA(TASK_NUMBER, MOTOR_DETAILS, TEST_DATE) Table.

Note: I am also Saving PROJECT_ID from Table1 to Table2 when EDITFORM2 is saved.

In Screen3, I am having a TaskGallery Where in its (Title, Subtitle and Body) I am having (TASK_NUMBER, MOTOR_DETAILS, TEST_DATE), When NextArrow in TaskGallery is selected it navigates to Screen4.

 

Now my Issue is, In Screen4 I am having a DisplayForm, where its Datasource Property is set to TASK_DATA(Table2) But I also want to show respective (CUSTOMER_NAME, PROJECT_NUMBER) from Table1 with the help of respective PROJECT_ID in Table2.

Can anyone help me how to join two tables with its common unique ID in DisplayForm.

4 REPLIES 4
Community Support
Community Support

Re: How to Join two Tables with common Unique ID in DisplayForm. So, that all fields from both the tables must be visible in that DisplayForm.

Hi @Chandu ,

 

You can either add another DisplayForm on the same screen, and set its Item property to:

Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text)

Where DataCardValue1 is the label control name in the PROJECT_ID field data card of TASK_DATA display Form.

 

Or, you can unlock all the data cards inside TASK_DATA display Form, and insert new controls to display data (CUSTOMER_NAME, PROJECT_NUMBER) from PROJECT_DATA. The formulas should be something like:

Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text).CUSTOMER_NAME
Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text).PROJECT_NUMBER

 

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Chandu Helper II
Helper II

Re: How to Join two Tables with common Unique ID in DisplayForm. So, that all fields from both the tables must be visible in that DisplayForm.

you can unlock all the data cards inside TASK_DATA display Form, and insert new controls to display data (CUSTOMER_NAME, PROJECT_NUMBER) from PROJECT_DATA. The formulas should be something like:

Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text).CUSTOMER_NAME
Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text).PROJECT_NUMBER

 

I followed the above Solution. My requirement is working now. But, getting error at CUSTOMER_NAME Datacard Default Property: Thisitem.CUSTOMER_NAME. Same error with PROJECT_NUMBER Datacard Default Property: Thisitem.PROJECT_NUMBER from PROJECT_DATA.

 

How to remove that Error for better performance of the app.

Community Support
Community Support

Re: How to Join two Tables with common Unique ID in DisplayForm. So, that all fields from both the tables must be visible in that DisplayForm.

Hi @Chandu ,

 

You shouldn't use the columns from PROJECT_DATA for the data cards, as the data source of this display form is actually TASK_DATA. If you do not want to see the fields' value of TASK_DATA, you can just set the Visible property of these controls to false.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Chandu Helper II
Helper II

Re: How to Join two Tables with common Unique ID in DisplayForm. So, that all fields from both the tables must be visible in that DisplayForm.

Hi @v-monli-msft,

you said that: unlock all the data cards inside TASK_DATA display Form, and insert new controls to display data (CUSTOMER_NAME, PROJECT_NUMBER) from PROJECT_DATA

 

insert new controls means, for PROJECT_NUMBER, I should take TASK_NUMBER from TASK_DATA and formula should be something like: 

Lookup('[dbo].[PROJECT_DATA]',PROJECT_ID=DataCardValue1.Text).PROJECT_NUMBER

 

Helpful resources

Announcements
secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,254)