Exception Save Data

I have a large form that the users usually complete in one session where the data is written to a db upon submit. In some instances the user will start inserting data into the form but then leave their desk.
We have a requirement to abandon the form after 30 minutes and close the case. We do this by using an exception with a 30 min timer to an end event.

After testing and acceptance - the request has changed slightly. Now when the 30 minutes are up - the user wants the existing data to automatically be written to the DB.
I had thought to add a write to DB on the exception route. However upon testing It wasn't working and that would be because without the submit button, nothing is getting written to the PV! and therefore the writetoDB node has no data to write.

Is there anything I can do to give me an autosave type function ?

  Discussion posts and replies are publicly visible

  • This type of thing comes up a lot.

    It's hard to package the response up into a single answer that suits every use case because the needs of every enterprise vary.

    One thing you could try is to separate sections of the form down into a series of smaller "wizard" style forms.  As the users move from one form to the next, you can save the data from each form.  Alternatively, you could use write to data store from SAIL (a!writeToDataStoreEntity()) and capture each field as the data is entered.  Again, not every solution works for each situation.

  • Normally I'd agree. However in thi case the form is to complex for either solution.

  • You could use a!writeToDataStore() directly from the Form (you could call this after EVERY field's value is saved!) although:

    1. that would have to mean every column in the DB (except the Primary Key) would have to be optional (NULLable) to allow the data to be stored with missing column values
    2. make the interface very chatty (not sure what the performance impact would be)
    3. you'd have to find a provide a means of removing the data from the database as the flip-side of cancelling out of the form (although I think this would be a trivial case of detecting the Cancel event and using either the Delete from Datastore Smart Service in Process or its a! equivalne tin the form)

    (I just had a brief play around on this and it appears to work: accumulate the data in the correct type in a rule input; in any given field's saveInto: save the value to the correct attribute and then follow up immediately with an a!writeToDataStoreEntity. In the onSuccess save the fv!storedValues back to the rule input value so that you now have the generated key...and rinse and repeat for every field!)

  • I'm curious - why would the form be "too complex"?