Write action - Auto detect

How to configure ChronoForms Auto Detect for proper data insertion.

Overview

The Auto Detect action fails to insert new records because it relies on finding a record ID in the form data to decide between an update or insert.
Instead of using Auto Detect, set up a Read Data action with your conditions. Then, use a Save Data action set to Update in the 'found' event and a separate Save Data action set to Insert in the 'not found' event.

Answered
ChronoForms v6
Ma Maxvl 20 Nov, 2018
Hello

If in Write action - Update data is updated. If in Write action - Insert data is inserted.

If in Write action - Auto detect data is updated but not inserted.
Why is that? What you need to specify so that the insert is?Write action - Auto detect image 1
Thank you
Gr GreyHead 20 Nov, 2018
Hi Maxvl,

The Data Save looks for a record id in the form data - if one is found it updates the existing record, if not it creates new one.

Bob
he healyhatman 20 Nov, 2018
Also you're telling it to update only the records that match the user id, account, AND the date. Is that right?
Ma Maxvl 21 Nov, 2018
Right, master need to specify the number every day. Sometimes the number is incorrect, then it is indicated again.
It is not clear why the record is not create...
he healyhatman 22 Nov, 2018
1 Likes
Okay well do it this way.

Have a read data action, the where conditions taken from your update conditions you have now. In the "found"event have a save data set to update. In the "not found" have a save data set to insert.

Auto detect only seems to work when you have an id you're checking on
Ma Maxvl 22 Nov, 2018
what data format do i need to specify for the update to be monthly?
when {date:Y-m} not executed
he healyhatman 22 Nov, 2018
Try
EXTRACT(year_month from model.date):{date:Y-m}

Probably won't work and if it doesn't do
YEAR(model.date):{date:Y}
MONTH(model.date):{date:m}
Ma Maxvl 22 Nov, 2018
what is the syntax ?
created(model.date):{date:Y-m}
he healyhatman 22 Nov, 2018
Answer
The syntax is what gave you. Replace model.date with the name of your model and date field (so created I suppose)
This topic is locked and no more replies can be posted.