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

Showing Records from different entities

Hi People,
I have a requirement in my app that in a single tab we need a table of all records from different entities.
Is it possible?

9 REPLIES 9
Highlighted
Resolver IV
Resolver IV

Hi @rahulmathur7 !

 

Can you be a little more specific. What are you trying to accomplish? How are the entities related to each other? 

BR

Pontus

Highlighted

@pontusofswedenWe have 3 entities in which I have different records and those 3 are not related to each other but at a single screen I need to show the list of all records and along with those records an added column in which it will display the entity name.

Highlighted

Ok! Do you have the same column names (ish) in all the entities? One approach is to create a collection where you merge all the records from each entity and add a column for the Entity name. Then you can use the new collection as a single datasource in a gallery. Here is a sample formula to merge the records:

 

ForAll(TableA;Collect(NewTable;AddColumns(TableA;"Entity";"TableA")));;ForAll(TableB;Collect(NewTable;AddColumns(TableB;"Entity";"TableB")));;ForAll(TableC;Collect(NewTable;AddColumns(TableC;"Entity";"TableC")))

 

If you have different column names, you can add conditions for the labels in the gallery. Like:

 

If(!IsBlank(ThisItem.Name);ThisItem.Name;If(!IsBlank(ThisItem.Names);ThisItem.Names;If(!IsBlank(ThisItem.Namn);ThisItem.Namn)))

BR

Pontus

 

 

 

 

 

 

 

Highlighted

@pontusofswedenThanks for your reply!
No, I don't have any columns with same name in all 3 entities And also what are you referring to when you said "Table A".?
I just need a list of records.

Highlighted

Hi!

 

TableA is in your case EntityA (since I dont know the name of your entities). The problem is that you can only use one datasource in a gallery, for instance. My suggestion, according to the formula provided, is to merge EntityA, EntityB and EntityC into a new Collection (NewTable) that you can use as a datasource in the gallery. With this formula, all records in the list will have a reference to the Entity which you can show on the screen.

 

BR

Pontus

Highlighted

@pontusofswedenWe did manage to create a collection the trouble that we are having is that we are not able to add a column that specifies the name of the entity that record is from.
Can you help me with that?

Happy Holidays

Highlighted

Hi @rahulmathur7 ,

Do you mean that you have 3 entities that have no relationship, you want to save them to the same collection and add a column record its entity names?

If so,I've made a similar test for your reference:

Since these three entities have different column names, I'm afraid you need to firstly create a table will all fields'name that these three entities have. Or else, you can not save them together.

Try this formula:

ClearCollect(newentity,{field1:"",field2:"",field3:"",.....,entityname:""});
Collect(newentity,AddColumns(entity1,"entityname","entity1"),
                  AddColumns(entity2,"entityname","entity2"),
                  AddColumns(entity3,"entityname","entity3")
       )

Please note that you need to pay attention to the data type in step1. "" represent text type. If the field is not text type, then you could not update successfully in step2.

If it is a choice type, you need to use fieldname:{Value:""}  at step1.

If it is datetime type, you need to use DateTimeValue("") at step1.

 

Best regards,

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

@v-yutliu-msftThank you so much.
Should I write this code on OnVisible Property of the page where I want to show the data ?
Sorry im a beginner in powerapps.

Highlighted

Hi!

 

Yeah, you need to trigger the merge somehow. Maybe on OnSelect of the button that gets you to your screen? OnVisible is also an option of course, I rarely use it myself but it´s doable.

 

BR

Pontus

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 (9,452)