Hi,
does anyone know if there is something special to do with the id of
tables for the Auto detect Write Action to work in Database -> Save
Data functions ? I try to modify the dynamic actions demo for my own
needs on a table different than #__content but it doesn't work. In the
demo, the save function is used for both creation and modification of
articles thanks to this functionality. But in my case, it always create
new table entries😟 When I specify an Update Condition like
Article.id={data:article_id}, the modification works but then the
creation doesn't and vice versa... I know I could create 2 different
functions but I'd like to understand why this doesn't work in my case.
Any help anybody ?
Regards,
jc
does anyone know if there is something special to do with the id of
tables for the Auto detect Write Action to work in Database -> Save
Data functions ? I try to modify the dynamic actions demo for my own
needs on a table different than #__content but it doesn't work. In the
demo, the save function is used for both creation and modification of
articles thanks to this functionality. But in my case, it always create
new table entries😟 When I specify an Update Condition like
Article.id={data:article_id}, the modification works but then the
creation doesn't and vice versa... I know I could create 2 different
functions but I'd like to understand why this doesn't work in my case.
Any help anybody ?
Regards,
jc
Hi JC,
​
The auto detection will do an update only if a value of the table's primary key is passed with the data, so if your data provider array does not have a value for the primary key then an insert will be trigered.
​
Best regards
​
The auto detection will do an update only if a value of the table's primary key is passed with the data, so if your data provider array does not have a value for the primary key then an insert will be trigered.
​
Best regards
Hi Max,
you're so strong🙂
The only thing I changed is to add the Id in the form fileds and it worked. But I wonder why. The Id should have been loaded fron the table, shouldn't they ? In read_article ou read_articles. Hmmm ?
Best regards,
jc
you're so strong🙂
The only thing I changed is to add the Id in the form fileds and it worked. But I wonder why. The Id should have been loaded fron the table, shouldn't they ? In read_article ou read_articles. Hmmm ?
Best regards,
jc
Hi again,
may I respond to myself (may be usefull for someone... who knows).
In the case of article creation (New blue button), the edit event is called with no paramters. The read function doesn't find anything, hence there is no creation of an Id variable and so, Auto detect can't detect anything, and make the bad choice🙂 Adding a Id field in the form solves the problem because then Auto detect has a Id variable to work on. Am I right ?
Best regards,
jc
PS : I read in the FAQ of CC6:
I didn't find the later part😉 And, I really wonder what these Events of read functions (record found event, record not found event) are made for. Especially Enable the record not found event.
may I respond to myself (may be usefull for someone... who knows).
In the case of article creation (New blue button), the edit event is called with no paramters. The read function doesn't find anything, hence there is no creation of an Id variable and so, Auto detect can't detect anything, and make the bad choice🙂 Adding a Id field in the form solves the problem because then Auto detect has a Id variable to work on. Am I right ?
Best regards,
jc
PS : I read in the FAQ of CC6:
(assuming a record is found, we will cover the not found possibility in a later part)
I didn't find the later part😉 And, I really wonder what these Events of read functions (record found event, record not found event) are made for. Especially Enable the record not found event.
Hi JC,
​
Exactly, when no id value is passed, no record is loaded and so the id field in the form is empty and an insert is auto selected.🙂
​
The not found situation can be solved with a switch function, I could not add more Connectiivty FAQs since that time but I will try to add more soon.😉
​
Please post any questions you may have on the forums and I will try to answer!
​
Best regards
​
Exactly, when no id value is passed, no record is loaded and so the id field in the form is empty and an insert is auto selected.🙂
​
The not found situation can be solved with a switch function, I could not add more Connectiivty FAQs since that time but I will try to add more soon.😉
​
Please post any questions you may have on the forums and I will try to answer!
​
Best regards
This topic is locked and no more replies can be posted.