Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can set the attribute '''autocreate''' in a '''query''' element.<pre>

Code Block
languagehtml/xml
<query name="customers" autocreate="true">

...

This property applies only when users submit an HTTP PUT request to the database connector. The property tells the database connector to create a new row in the database if one doesn't exist already meaning that the connector will run the '''create''' statement automatically if the '''update''' statement fails. In summary: *

  • If the user is updating an existing record, the Update statement will work as it normally does and the autocreate function won’t kick in.

...

  • If the user is adding a new record, the '''update''' statement will fail (by design, because the record cannot exist if the user hasn’t added it yet) and the Connector will then run the '''create''' statement.   

The autocreate feature is particularly useful when working with frevvo's '''repeat''' control. frevvo's repeat control gives you the ability to work with dynamic collections, for instance: customers, cars, addresses, dependents and others. When the user loads the form, the form may be initialized with some items (we will see how to do that with frevvo later). If the user adds new items to the collection and submits the form, those items will be automatically added to the database if '''autocreate=true'''

...