Prepopulating a table and "group by"

Prepopulating a table and "group by"

  
Hi,

I am trying to create tables of information within another larger table.

eg. Looks something like this
Project costs
cost type    Estimated cost     account No    Notes
Hardware                                  1234
Software                                    1235
Salary                                        1236
... etc
then same thing again for a different project
cost type    Estimated cost     account No    Notes
Hardware                                  1234
Software                                    1235
Salary                                        1236
... etc

The cost type field and account no fields almost always stay the same. So when the user brings up the field it should autopopulate the data with information shown above. All the user need to input is the Estimate costs and Notes.
So I have created a hidden cloumn which contains the ProjectID so I can "group by" each set of costs is associated with.

eg
cost type    Estimated cost     account No    Notes  ProjectId
Hardware                                  1234                           1
Software                                    1235                           1
Salary                                        1236                           1
... etc
eg
cost type    Estimated cost     account No    Notes  ProjectId
Hardware                                  1234                           2
Software                                    1235                           2
Salary                                        1236                           2
... etc

And put in this:
Project 2
project name Make Budget
Timeframe 1 year.

+
cost type    Estimated cost     account No    Notes  ProjectId
Hardware                                  1234                           2
Software                                    1235                           2
Salary                                        1236                           2
... etc

I am new to out systems - How would I set something like this up ?

1. I'm guessing I need to use the filter to group by Project id to get just the fields associated with that particular projectID?

2. I would need to add to the project costs table a set of the premade records for a project? Not sure how to do that in outsystem.




Hi Michael,

First of all welcome to OutSystems community! I hope you have a lot of fun.
Since you are starting let me give you a couple of pointers. A great place for newcomers is the online training.
Now for what you trying to do...
The simplest way I see it would be to add some logic in the preparation. So I assume you have a preparation on this screen where you will fetch the project costs if they are already created. Then you can test (check the empty property of the aggregate return) if you have them or not and if you don't you can append new records (using ListAppend and a local variable of type ProjectCost) to that same list (the output of the aggregate) with the data you want.

I hope this helps.
Cheers
Thanks for your help.