I'm trying to add a new record to a table through a edit record popup modal. Upon the modal closing the table will refresh and show the new record. I have a set up for this but the problem is the new record created is assigned to the FAQtable.current record so it's replacing the last record within the list of existing records.How do I stop this and simply add the new record as an addition to the existing table?

Hi,


For adding new records, you must pass the identifier as null with the forms field.


Thanks

Jaret Sanchez wrote:

I'm trying to add a new record to a table through a edit record popup modal. Upon the modal closing the table will refresh and show the new record. I have a set up for this but the problem is the new record created is assigned to the FAQtable.current record so it's replacing the last record within the list of existing records.How do I stop this and simply add the new record as an addition to the existing table?

Hi Jaret,

This is happening because you must be setting new values to the current object in your record list like this

YourObject.List.Current.Attribute = <something>

Instead you should create a new local variable of the same type of your list. Assign values from your popup fields to this lcoal variable and append it to your record list which you are using in your table.

This will add a new row to you list and hence to your table as well.


Jaret Sanchez wrote:

I'm trying to add a new record to a table through a edit record popup modal. Upon the modal closing the table will refresh and show the new record. I have a set up for this but the problem is the new record created is assigned to the FAQtable.current record so it's replacing the last record within the list of existing records.How do I stop this and simply add the new record as an addition to the existing table?


Hi Jaret, 

Nikhil's suggestion will work's  fine for you problem, but if you want something else then you should try Editable table widget, this widget has in- built functionality to add, edit and delete records in runtime in the table itself. Refer to the link:

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Traditional_Web/Web_Interfaces/Designing_Screens/Editable_Table_Widget

Thanks :)

Jaret Sanchez wrote:

I'm trying to add a new record to a table through a edit record popup modal. Upon the modal closing the table will refresh and show the new record. I have a set up for this but the problem is the new record created is assigned to the FAQtable.current record so it's replacing the last record within the list of existing records.How do I stop this and simply add the new record as an addition to the existing table?

First you assign a variable that is an element of the list, then you ListAppend it to the the widget's list

You may need to refresh the table widget after the append so it shows up