cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

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

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.

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.

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.

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,854)