User Expansion Form (Add a row)

User Expansion Form (Add a row)

  

Hi Everybody,

I'm tinkering around with Outsystems trying to learn the environment and I hit a brick wall on input forms.

I'm using the mobile module and have a form which has several sections.

In one section I want to start with one line item, then have the user hit a + sign to add another row.

The best example I know of this would be a recipe manager app that my wife uses, image below.

What would be the best way to accomplish this in outsystems?

Outsystems do not allow you to use recordlist/lists in a form, but there are easy work arounds.


1. Create your record list in a webblock and drag the webblock in your form. 

  • Based on the case, this might not be the best option. Since it is in a webblock, every time an user action happens on that recordList you will have to use onnotify to push your changes to the parent. (if you use this option , sending JSON  as notify to the parent is in most cases the best option)

2. Create your record list outside your form and create your own validations when saving:

  • In the preparation create an aggregate which retrieves the information for the recordlist and store them in a variable
  • Assign the recordList to that variable
  • Adding new records, you will have to store them in the variable and refresh the table
  • Deleting records which have been added in memory: just delete the record from the table/variable
  • Deleting record which have already been saved in the database and the user wants to delete them :Store the deleted records in an extra variable (ex : deletedRecordsFromDB)
  • When saving loop trough the deletedRecordsFromDB and delete them
  • You can easly define if a deleted record is from the memory or was already present in the DB and you want to delete it: If the id of the record is NullIdentifier(), then just delete it from the table/variable. If it's not Nullidentifier(), it means the record was already saved in the database and you will have to remove it from the DB when saving.(so store them in the variable deletedRecordsFromDB)

If you're stil encounter some issues, you can send me a message and I will create a working example.

Greetings,
Niels

Thanks for the pointers,

I found a less programmatic way of accomplishing what i needed.


I create 30 "Item" columns in my DB (Don't exepect that many), then used a local variable to hide them on the form if variable is less than a number the item number.

A button increments the Variable to unhide items as the button is clicked.