Hey everyone,


I have a parent table and a child table. I have created the Parent Table's List and Detail screens, as well as the Child Table's Detail Screen and popup for editing.

Is it possible to search the child table data from the parent table's List Screen and show the results? 


Thanks for your help!

Marios


Hi,

When you say Parent and Child, do you mean that there's a foreign key connecting both of them? If you have a way to associate both tables and it makes logical sense to have them together, there's nothing stopping you from displaying both tables in the same screen and having your Aggregate search in both.

Solution

i am not sure if you need to show the child values on the parent detail or only search for that values.


For example if you have table A and B, A is Parent Of B and B have atribute isman

If you need to search in the screen all the father records that have a B chield with isman True


You can do that with exists.


Now if you want to display the values of the childs in the Parent detail then you have 2 options:

1st you do a inner join like Afonso Carvalho sugested but then you have the problem that for each child Record displayed in the table you will have the same parent like this:


A1 - B1

A1 - B2

A1 - B3

A2 - B4


2nd You can list all the parents and inside each parent you can insert an webblock where you use the parent id as an input. Inside that webblock you will list all child from that parent.


here an example

Solution

Thanks, Alfonso and Carlos :)

Carlos, I am aware of the first issue, and I'd like to do the second solution. Is there a tutorial on how to do it?


Thanks!


You can group attributes in an Aggregate to just show the Parent fields that you want and not have any duplicates because of the child Entity, or worst case scenario, write an advanced query that returns only the fields you want if you end up needing more features than what Aggregates allow:

But I'm a bit confused. You want to be able to search for fields inside records associated with an Entity, but not show them on the table? This is certainly possible if you do the above, but it's not common as it might end up confusing users ("why am I seeing parents that say Andrew if I searched for Jim?").

Yeah, I want to show the Parent based on a child search. And then perhaps show, using a Web Block the child table data.

How do I Show/Hide the web block as per your example?

Thanks!

Marios


You could have a webblock in one of the columns surrounded by an If, and then check to see if the current record of the Aggregate has a Child.Id on it. If not, you know it's just a Parent, and you don't need to display it.

https://carlosdiogo.outsystemscloud.com/FunTesting/Home.aspx?_ts=636958474399139061

each entity only have one atribute the bold one is the father and the normal text are the child


here i made a quick one just to show as an example 

oml in attachment



OK, Thanks! 

How can I toggle the Child Table data on demand?

Marios


Toggle being display/hide? You can use a Section from SilkUI. Check the demo here:

https://silkui.outsystems.com/Patterns_Web.aspx#Web_Content_Section

Marios Tofarides wrote:

OK, Thanks! 

If there is a Child Id, how can I get that +/- button to Show and Hide the Child data on demand?

Marios


i did an action function that return true of false if exists childs and only show the +/- if that function is true (receive as parameter fatherid)


To show and hide, i have an aditional atribute in the query "isopen" that as default is false

 when i click the plus i change the icon to minus and refresh the container that have the weblock.


https://carlosdiogo.outsystemscloud.com/FunTesting/Home.aspx?_ts=636958487315585019

I've managed to do it using the Accordion Widget.

Thanks for everything!

Marios