How to do a list within a list

How to do a list within a list

  
I have the need that for any record in a record list to potentially display several additional records for that record within that list (i.e. list within a list).
 
For example, in a Travel application, I want to display trips in a record list, and then display a sub-list for trips showing the additional passengers for that trip.
 
date type  location departure_time arrival_time
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
               Additional passengers:
               xxxxxxxxxxxxxxxxx
               xxxxxxxxxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
               Additional passengers:
               xxxxxxxxxxxxxxxxx
               xxxxxxxxxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
...
 
Please let me know how this could be done in Outsystems.
Hi!

Don't know if this is the only way or if it is the best. But if you want a List A (Id, Atribute A, Atribute B, List B).
First you have to create de List B with the atributes you want and after that you create List A and one of the atributes you add, set data type to Record list and the record definition to List B.

Hope it helps
i would have gone for this approach:

create webblock1: ie. Flights
set an input record for the flight
and build the flight table

create webblock2: ie. Passengers
set an input record for the passenger
and build your passengers table
if there are no passengers, dont display the table

now for webblock3 or your screen:
create a structure with 2 fields (flight_id and text)
and create a table based on this structure, but only show the text column
append all flights you want to display to this table

and finally drag-drop your webblock1 and 2 into the text column

also you will have to move the header from webblock1 to webblock3 and process sorting separately
unless you want a repeating flight header

but this way you should be able to get 1 table,
where the subtable (passengers) doesnt have to be on the same line as the flight
Hello,

I know a way that you can do that using grouping sets but it only works on SQL Server 2008 or higher version.
If you need some samples check the post on my blog about it:
http://learnagile.blogspot.pt/2012/04/sql-server-2008-grouping-sets-in-sql.html

For more information about sql server grouping sets syntax i would suggest you can check the following link:
http://msdn.microsoft.com/en-us/library/ms177673.aspx

There's other ways they but they can be more inefficients, like building a string with the dynamic html code (table) and use it on the screen as a expression with Escape Content = No.

Hope it helps...

Best regards,
Luis Paulo Soares


Gerald Seidl wrote
:
I have the need that for any record in a record list to potentially display several additional records for that record within that list (i.e. list within a list).
 
For example, in a Travel application, I want to display trips in a record list, and then display a sub-list for trips showing the additional passengers for that trip.
 
date type  location departure_time arrival_time
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
               Additional passengers:
               xxxxxxxxxxxxxxxxx
               xxxxxxxxxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
               Additional passengers:
               xxxxxxxxxxxxxxxxx
               xxxxxxxxxxxxxxxxx
xxxx xxxxx xxxxxxx xxxxxxxxxx        xxxxxxxxxx
...
 
Please let me know how this could be done in Outsystems.
 
 
Luis Paulo Soares wrote:
 
 
 
 I did this with addtional lists and widgets in web blocks and it works well. Thanks to everyone for the help!
Hello,

Yes it works fine but it also make 1 more database access per record. If the table doesnt have many records it works fine. Its more inefficient and slowly and not recomended for reportings with a high volume of data.



Gerald Seidl wrote
:
 
 I did this with addtional lists and widgets in web blocks and it works well. Thanks to everyone for the help!
 
i have to agree with the performance point of luis

although this could alternatively also be handled with 1 select in the main screen
plus some actions that spread (append) the main records to the according webblocks

or depending on the requirement, gerry can also show all flights for a 1st
and have a button to expand the passengers sub-table
so passengers are only selected when explicitly requested by the user