cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AraSaber12
Level 8

Join 2 tabels in PowerApps.

Hi Guys,

 

I have been trying everything to fix below problom. Unfortunately i could not fix it.

 

I have 2 tabels from different database one called Employee and the other one is sickness table.

 

employeenrfirstnamebirthnamefunctiondeccostcenter

123AraSaberIT0
     
EmployeeIDHoursickness-startsickness-endreason
123105/2/20195/2/20190

 

So what i want is that as you can see in below picture. I want to see in 1 screen the data of my employee and also the data of my sickness table. When I play the screen then i can only see the employee data and not the sickness data. I tried many time the lookup functions as you can see, but it doesn`t work.

 

Could you please me out here?

 

LookUp('[DSL].[MDS_EMPLOYEE_SICKNESS]';EmployeeId=EmployeeNr;Sickness_End) this what i use

 

Untitled.png

1 ACCEPTED SOLUTION

Accepted Solutions
AraSaber12
Level 8

Re: Join 2 tabels in PowerApps.

Hi @NigelP,

 

Thank you for your trouble! 

 

I will show you how i finally fixed it. you will find the solution in the attachment. As you can see the Name box is Joined through Lookup function.

 

But I have 2 more issues now. As you can see in the second printscreen. I have a list of my employees. When I click on the icon to see more details. Then I dont get the same data of this employee in this case Ali. So in the overview screen you can see Name Ali and EmployeeID 1000501~~. and in the Detail overview screen I see on EmployeeID this: AJ~~Athena IT-Group A/S. This is different ID. So how can i fix this?

 

And one more importent thing i want to display on my Details screen is the total hours sickness of the employee ( Ali in this case). I will explain you better when a employee is sick then in the source database 1 row will be created in this case was Ali 2 times sick so to rows. So how can i calculate this so that i see 14 hours?

 

Code  EmployeeId                         Hours Reason 
3017 1000501~~Sentia MPC B.V. 7.00    Ziek 
3025 1000501~~Sentia MPC B.V.  7.00   Ziek 

 

Thank you so much for helping me!

 

Best Regards,

 

Ara

 

View solution in original post

11 REPLIES 11
NigelP
Level 8

Re: Join 2 tabels in PowerApps.

HI @AraSaber12

 

Do both tables have a common field eg Employee id ?

 

If so then you should be able to get the first table, then get the Employee id and use that using LookUp(2ndtable, Employeeid = 2ndtable.employeeid) to get the second table and then the record itself.

 

I see on your screen shot, you have two red circles.  These point to errors in your formulae.  The Screen will not populate whilst there are errors have noit been fixed.

 

Regards

 

Nigel 

AraSaber12
Level 8

Re: Join 2 tabels in PowerApps.

Hi @NigelP,

 

In table employee i have employeeID and employeeNR. In table sickness i have employeeID. employeeNR = employeeID.

 

Which forumla do i have to use? This one LookUp('[DSL].[MDS_EMPLOYEE_SICKNESS]';EmployeeId='[ISL].[Employee]';Employeenr)   ?

NigelP
Level 8

Re: Join 2 tabels in PowerApps.

Hi @AraSaber12

 

I am not too familiar with PowerApps and SQL Server, but are you sure you need a ";'" before EmployeeId.

 

Should it not be a ',' ?

 

Certainly, if you were using SharePoint Lists the format would be Set(SicknessRecordnr,LookUp(MDS_EMPLOEE_SICKNESS, EmployeeId='[ISL].[Employee]',Employeenr))

 

which gets the Sickness Record number in the global variable SicknessRecordnr.

 

To get the record itself :-

 

Set(SicknessRecord,LookUp(MDS_EMPLOEE_SICKNESS, EmployeeId='[ISL].[Employee]'))

 

 

Regards

 

Nigel

Anonymous
Not applicable

Re: Join 2 tabels in PowerApps.

Hi @NigelP

 

In europe we use ";" instead of "," and ";;" instead of ";". 🙂

I do not know why this is the case with us, but it is. x)

 

Regards

Vasii

AraSaber12
Level 8

Re: Join 2 tabels in PowerApps.

Hi @NigelP  & @Anonymous (thank you for your explaining)

 

Thanks for your response! What I want is this: Below you see 2 table in 1 screen the blue one is the data like name, birthname etc. of the employee. And the second table the green one is the data of the employee about the sickness.

 

What I want to do is when i play the screen i want to be able to modify the green table. The blue one must only display the data.

 

Unfornately when i play the screen I only the see the blue table data. What do I need to do to fix this?

 

 

Untitled1.png

NigelP
Level 8

Re: Join 2 tabels in PowerApps.

Hi @AraSaber12 @Anonymous

 

So make make the Blue screen a ViewForm and the Green Screen a Edit Form.

 

MAke the source of each form the record you want to view / edit .

 

REgards

 

Nigel

AraSaber12
Level 8

Re: Join 2 tabels in PowerApps.

Hi @NigelP,

 

As you can see in the printscreen i edited both of the table one edit form and the other one view form. Otherwise you can`t see this in the edit mode screen. But the problem is when I play the screen then I see this: only the employee data.

 

Untitled2.png

NigelP
Level 8

Re: Join 2 tabels in PowerApps.

HI @AraSaber12

 

On the Blue screen, what is the Item that is supposed to be shown ?

 

Pick an field and try Set(gTestvalue, ThisItem. <whatever field you are trying to view> ) withing the Form.

 

Then see if there is a value in gTestValue.  If there is not, then it is your SQL Statment, otherwise check the visibilty property of the form and the field.

 

REgards

 

Nigel

AraSaber12
Level 8

Re: Join 2 tabels in PowerApps.

Hi @NigelP,

 

Thank you for your response! As you saw in my previous picture you could only see the blue part when I play the screen (F5). 

 

As you can see I just tried your syntax. Unfortunately it does not work again.

Further everything looks okay to me. But i think it might be that PowerApps can not view 2 different databases on 1 screen? 

 

Untitled.png

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,548)