Hi
For my side, I build a var {data:modified} ={data:Y-m-d H:i:s} before the Save Action, I save with modified = {data:modified} and I read data WHERE modified = {data:modified}. In this case it's better to use a SQL action to return only the aid field.
If there is possible you have two (or more) SQL inserts in the same second, you can use more conditions in the read action, like user = {user:id}…
yes, I understand all that and I agree. but the question is:
In chronoforms 6 I can use $this->get('save_data3.aid');
why doesn't it work in chronoforms 7 and is there any working alternative?
I don't need to do another database read, just get the key and pass it on
that's what I'm trying to do, but none of the developers are answering me
Hi Ernst,
I suggest that you turn on Debugging after the data save - that should show you the structure of the data to see where the id is.
Bob
I did that of course, but I don't see the id anywhere (unlike chronoforms 6).
for ID question: use uuid!!!
in all of my tables i use a field named uuid (char 36) that is populated by a trigger (only if null)
it's usefull to align different database records and in case, like this, you want to know the newly generated id without doubt.
In MYSQL (with phpmyadmin is very simple to do) add a trigger for every tablehave uuid
this is the code inside the trigger:
BEGIN
IF new.UUID IS NULL THEN
SET new.UUID = RIGHT(UUID(),36);
END IF;
END
with CF6/CC6 (i don't know in CF7)
in your forms put a filed named uuid that use shortcode {uuid:} for the value of your uuid field
If you use only a form to modify/insert records, use the syntax {var:my_read_data.model.uuid/(uuid:)} so new record have an uuid created by shortcode {uuid:}
Now, when you save you know the uuid value {data:uuid} that is an unique id
read record that have that {data:uuid} and you have your data for sure without doubt.
is safer than use data, cause if you have two user that write records, 1 second is not enough and milliseconds could not be too.
for your question, have you tryed
$rs=$this->get("my_red_data", "default")