How to display a list of runtime objects before persisting it

I’m trying to create an app that distributes a survey to a list of people. I need to have a view where the user adds the names and emails of individuals who will receive a survey - I want to make it so that the user can add a name+email, then click an “add” button which makes this name+email appear in a list below to the input fields - then finally when all the recipients of the survey are added, the user can review the list and finally hit “done” which should then store this list in the database. Is there an example of this sort of functionality i can look at??

Hi, you can create this by adding the input fields for name and email bound to an object (runtime, cardinality 1). Once the user hits the add button you can read the object to the datasource (runtime, cardinality many) and create a new object in the first data source.

Use a list component underneath the input fields that displays the runtime properties. (datasource runtime cardinality many)

When the user is done adding all the names and emails and hits the done button, you’ll make sure it gets stored in the database by using the persist objects action on the datasource cardinality many.

This example uses and app variable instead of datasource (cardinality 1)

https://showroom-dev.appfarm.app/use-cases/comment-log

https://create.appfarm.io/apps/5ffc2431694c20bee725f7e6/ui-designer/6332ee0f5a7f5f2651affad3/6332ee245a7f5f2651affada

Hello!

It is also possible to simplify the above a bit! And maybe you also want that list of recipients to be connected to that survey?

I would suggest an Object Class Survey Recipient in the Global Data Model with properties Name, Email and Survey (link to the survey you are working on). Add a Data Source to your App: Survey Recipients (runtime only, cardinality many)

In the UI you would need

  1. 2 App Variables for Name and Email. Put them in the top, with a “Add” button to the right
  2. The “Add” button should do a Create Objects into Survey Recipients, setting the properties Name and Email with value from the two App Variables, and then set the two App Variables to null (clear them, to allow for adding more recipient)
  3. Below the top section: Use a list or some other custom listing to display the entries of the data source Survey Recipients (display the Name and Email properties)
  4. A “Save” button that persists the datasource above.