38
Views
2
Comments
How to add/append data to a list/table record before saving to database
Question

Hi everybody, 

I'm new to Outsystems, currently using ver.11 to develop a traditional web app. I am trying to create a screen which will show an empty list on load, then i have the plus button which on click will display the two input fields with the AddToList button, Cancel button and SaveAllData button . AddToList button will allow the user to add new data into the list.  And there comes the SaveAllData which will then save the data in the list to the database.

Can anyone help me do this in the traditional web app? (correction: I am not expecting someone else to do it and just gave the oml to me, i am humbly asking for advice or insights on how to do it,  but if someone is willing enough to give an existing example i'll gladly accept it. Thank you. ) 

I didn't have the OML cause i didn't know how to start it anyway.

Any help will be appreciated.

Thanks!

-Laurence

Rank: #136

Well Laurence,

you can't expect us to make it for you, right?  So some pointers only...

Here are some of the things you can think about

Variables

  • You'll need a place to store the items in your list as you are building it up : if your list always starts empty, not based on data already available in the database, you can just use a local variable for this.
  • You'll need a place to store the item that you are filling in the details of, before you add it to the list

Actions

  • there are list operations available, you'll want probably to use listAppend to add a single item to your list
  • at some point you'll want to iterate through your list, and for each item in it, do a Create in the database
  • you'll want to use the listClear after storing everything in the database, so your list is ready for adding some more new items
  • you might want to use Remove action on list if user can change his mind and take one out before saving to the database

Screen

  • you can choose to show/hide the input fields, either in the same screen as where the list is, or in a modal
    • showing would be whenever user chooses Plus button
    • hiding would be whenever user chooses AddToList (and maybe you also want a cancel button)


Can this get you started ?

Good luck,

Dorine