Skip to main content

Hi There

 

I am trying to pre populate a list with the contents of a template list in a Smart form and need to figure out how it can be done.

 

Basically I have a two data sources, a template list, which is used to prepopulate another list for editing and saving. 

 

The list  view needs to be populated from the template list when a drop down selection is changed.  I already have a Smart Form with a Header Item View and the detail list view which displays the template items when the drop down on the Header View is changed.  What I need to do is Transfer the data from the template list to the other list, as I cannot have anyone change the template list.

 

Any ideas?

 

Cheers

Alan

Alan

 

I am assuming you have 2 smartobjects - one for the template list and another for the editable list? If this is the case you can edit your editable list smartobject (assuming they are not both smartbox smartobjects) and add a new method that calls the list method for the template list. You can map the properties from the template smartobject into the editable list smartobject.

 

You can then trigger an event on the form to populate the editable list using the new method and passing in the required filter (your drop down box?)

 

The only downside of this approach is that populating a list view this way means that when you call the create method (e.g. execute the create method for all items that have been added)  the list items that have not been edited will not be saved. If you are certain all items will be edited this may not be an issue.

 

Another option is to create a smartobject method actually insert the template records into a database table (the table that holds the editable list) when you trigger the form event and then call a list method on the editable list to retrieve the new records (passing in a ID filter). If the user closes the form before saving you will end up with unwanted records in your database.

 

Finally, you could just let the users edit the template list, but modify (or create a new) create method on that smartobject that actually saves to the editable list smartobject. Again this might be an issue if not all items are edited before saving.


Reply