Table list from two different tables and display the records

Hi All, 


Thanks in advance. 


I am having a scenario like have two entities (Entity A data is coming from one source and saving here, Entity B data is coming from another source and saving. In both A and B having few are similar.)

Now the requirement is I have to take the ids from A and B and need to show in one tables list (display screen) and edit option. When edited , updated data should be save in to the required entities. 


I have done like created structure with required fields. Then in screen preparation first taken first entity A and used foreach and assigned data to structure then appended. 

Same for Entity B done.
But it is not working as expected.  

Could you please advise how to approach (Preferred with simple example). 


Thanks

Gangadhara.




 

Hi Gangadhar,

Assuming you have some kind of relationship between your entities A and B, you can pull the data from two using single aggregate. And then output can be stored in a List of structure using an assignment operator (no need for looping) and probably mapping the attributes properly. This List of structure would then be source for your table to display on screen. Similarly on the details screen you can bind the form with the structure, and finally on save action you can save the records in entities A and B using respective CreateUpdate entity actions.

Thanks,

Junaid

Junaid Ahmed Syed wrote:

Hi Gangadhar,

Assuming you have some kind of relationship between your entities A and B, you can pull the data from two using single aggregate. And then output can be stored in a List of structure using an assignment operator (no need for looping) and probably mapping the attributes properly. This List of structure would then be source for your table to display on screen. Similarly on the details screen you can bind the form with the structure, and finally on save action you can save the records in entities A and B using respective CreateUpdate entity actions.

Thanks,

Junaid

Hi Junaid and Gangadhara,

In support for Junaid's recommendation, it is essential that you set the correct Join condition between those two Sources in the Aggregate so that you can correctly match the needed information between Entity A and Entity B and map the combined information into the structure.

By the way, is it possible for you to show us the Entity Diagram containing Entity A and Entity B?

Kind regards,
Joseph Enriquez

Thanks Junaid and Joseph, 


Actual requirement is not join two entities, Need the data of entity A records some and then entity B records few as rows 


like

ID          Name     Price   Address

A112     AAAAA    10     USA

B112    BBBBB      20     INDIA

A116    AA2AAA    25    China



Like this need. I think here join is not required as I guess.


Attached the Entity diagram for reference. Here two entities looks same but data is coming from different sources and saving different entities. 


So from the above two tables I need to take few columns and will show in disply screen as records then need to be edit required fields and after saving/updating , those has to be saved accordingly.


Thanks

Gangadhara





Hi Gangadhara,

With regards to this section you mentioned:


"I have done like created structure with required fields. Then in screen preparation first taken first entity A and used foreach and assigned data to structure then appended. "

Does your data structure include a list of records with at least two attributes for each of the entities?
I think this would enable you to do what you require.

But perhaps then the table would have empty columns when for instance you have Entity A record filled out but Entity B is empty for the corresponding record, so not sure how to overcome that issue.

Solution

Hello, 

I think the easiest way is:

Use SQL queries for both with union to pile up the results, like:

SELECT A.FIELD1, A.FIELD10 FROM A

UNION

SELECT B.FIELD11, B.FIELD3 FROM B

The output structure shouldnhave the attributes you need. The output list will have the desired records from both entities. 

Or

In preparation: 

A) do both aggregates, creating calculated fields in both (same name), that will hold the data you want to show. 

B) use ListAppend server action to add one list to another doing the mapping

The list that received the other will have everything, use as source. 

And things likenthat. 

Cheers

Solution

Thanks Dylan and Eduardo.


I will try with this.