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

Collect data into a single collection from two entities in CDS

Hello Experts ,  Can someone help me to collect data from two Entities. I am struggling to write formula for that.  ? 

 

the entity names are worker and worker fixed compensation ... I am not sure what else information should i provide . please let me know if more information is required.. thanks

8 REPLIES 8
gabibalaban
Level 8

Re: Collect data into a single collection from two entities in CDS

Can you be more specific ? Are you trying to gather all data from worker fixed compensation entity or only a specific number of columns ? The relationship between the entities is one to one ?

 

Try this one, to add only one column:

ClearCollect(Result, AddColumns(worker,"AddedColumnName",LookUp(worker fixed compensation, ID=worker fixed compensation[@ID]).ColumnToBeImported))

 

If your database is a large one, you'll have to wait a while. So I'll recomand to Filter the data from the two entities with the ones you are really interested in and after that to do this operation locally. 

P_SA
Level: Powered On

Re: Collect data into a single collection from two entities in CDS

 I have two entities.

 Entity 1 : Worker
 Entity 2 : Worker fixed compensation 

 

 In Entity 1 , there is a field named " Full Name "  . I have a gallery connected to Entity 2 .. 
 there is a common field in both entities called " worker " . In entity 1 it is a unique identifier and in entity 2 it is a lookup value.... 

 I want display the full name in the gallery by doing a lookup on the entities.. How do i solve this ?

gabibalaban
Level 8

Re: Collect data into a single collection from two entities in CDS

Put in Items gallery  property the following:

AddColumns(Entity 2,"Full Name",LookUp(Entity 1, worker=Entity 2[@worker]).Full Name)

 

and then inside gallery insert a label with the Text property ThisItem.Full Name

Highlighted
P_SA
Level: Powered On

Re: Collect data into a single collection from two entities in CDS

getting this errorUntitled.png

gabibalaban
Level 8

Re: Collect data into a single collection from two entities in CDS

The 'worker' inside the brackets has to have the first letter capitalised ( this is in entity right ? 'Worker') 

P_SA
Level: Powered On

Re: Collect data into a single collection from two entities in CDS

Yes Worker is there in both entities...   I changed it capitalized... still i face the same error. 

gabibalaban
Level 8

Re: Collect data into a single collection from two entities in CDS

Last try from my side: 😊

1. You have too many closing brackets (it's one, not two at the end) .

2.  Change inside the  lookup:

      'Worker Fixed Compensation'[@Worker] with Workers[@Worker]

Microsoft v-siky-msft
Microsoft

Re: Collect data into a single collection from two entities in CDS

@P_SA,

 

Please try this:

 

AddColumns('Worker fixed compensation ',"FullName",Worker.'Full Name')

 

The database relationship call of CDS is very convenient, just use <LookUp field>.<RelatedEntityField> to call any fields in related entity.
Sik

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 (5,833)