How to display a UNION of 2 entities in 1 ListRecord without SQL hardcoding?

Hi All,

Does anyone know how to display a UNION of two similar entities in one ListRecord without SQL hardcoding?



Hi Yuri,

Have you tried using a ListAppendAll?

Hi Kilian,

yes, I thought about this. Question is, I'm querying two very long tables (i.e. 100K+ rows), actually this is two queries to one table. And grabbing all this into memory and including in ListRecord by ListAppendAll is tough option...



I understand. But a ListRecord needs a single list as input. Alternatively, you can of course use two ListRecords and style them so they look one.

That said, if there's a 100K rows, do you really need to display those all on the same screen?? That's seems a bit excessive? And a bad user experience, I'd think.

Ok, I see.

My case is actually list of individuals (lots of data) and relations between them. I need to show individuals and be able to show (and edit) list of relatives in new window. 

How would you recommend to build UI for this?

There is entity Relatives which got Infividual_1_id, Individual_2_id and RelationType_id.

Hi Yuri,

You can show list of individuals in one web screen and when you click on particular individual, show the relatives of that particular individual in different screen and allow user to edit relatives.


Sivaramakrishna Repalle

Hi Sivaramakrishna,

You're right!

But for given User_Id="Yuri" from first web screen there could be two types of relatives: (1) those who got "Yuri" in Infividual_1_id field and (2) same but in Infividual_2_id.

How can I put them in one ListRecord at 2nd screen? 

I think you need to maintain two separate lists in this scenario like relatives of yuri in one list and individuals whose relative is yuri. or fetch all in single query with some self join instead of two separate queries.


Sivaramakrishna Repalle

So this is my question: how to fetch them in single query like 'SELECT * FROM A WHERE Infividual_1_id = "Yuri" UNION SELECT * FROM A WHERE Infividual_2_id = "Yuri"; ', but without SQL statements

I'm trying to find a way to to it using standard Aggregate.


Try this, in the aggregate select the source entity A and in the filter use (Infividual_1_id = "Yuri" OR Infividual_2_id = "Yuri"), i believe both Infividual_1_id & Infividual_2_id are attributes of entity A


Yes, you can use a query left-joining both tables. That'll result in an empty record for one of them, but with some screen logic you can patch that. But given that Yuri will not have that many relatives, my original ListAppendAll solution could be applied as well.

Thank you both, gentlemen.

I've checked and it all works fine. Screen logic is more complex then I expected, but anyway it's much better then all I tried to invent :)