Forums

DB Save not executed when expected

MichielStr 16 Apr, 2013
Hi,

I am still working on a problem I posted about earlier and hope someone could help me out. This is my setup:



I would expect this to work, because I am looping through all matching records and with each loop, the previous record does not get selected anymore because of the changes I made. Until there are no more records left to select.

The problem is, that the DB Save action is not executed when I would expect. If I do nothing to the form->data array, only the first record is updated. When I clear form->data before the Event Loop, only the 2nd record gets updated. Which, I think, means that DB Save is executed after the loop completes.

How can I solve this? For particular reasons (different users get different emails) I cannot run one major UPDATE query and send bulk mail, but have to handle each record individually.
GreyHead 18 Apr, 2013
Hi MichielStr ,

I don't begin to understand this :-(

Why not just get all the data and use a PHP for loop to process each record in one pass. It's not hard to add Joomla! code to send emails in there if you need them.

Adding debuggers to this might give you some clues but my best guess would be that the DB Save isn't updating the correct record.

Bob
MichielStr 24 Apr, 2013
Hi Bob,

I guess I am sometimes expecting CF to take more work out of my hands than it can... Somehow I tend to use it as a WYSIWYG php code generator. And in fact, CF has all the actions that would suggest it can actually do that.

DB Multi Record Loader, Custom Code, DB Save, Loop. Exactly the steps you would use when hand-coding in php. And really, it should be possible to do this, if CF would actually execute the actions in the order in which I place them.

Anyway, I had in fact already found the Sendmail function of Joomla and am using that now. That also solves a problem I posted about in another post, of storing variable-names in a database table which would later get filled by CF. Sendmail can be quite a challenge, though, if you have to inject 40 variable values into the mail(ing)
GreyHead 25 Apr, 2013
Hi Michiel.

ChronoForms is pretty good as a drag and drop builder but it has some limits, and loops are one of them. Sometimes it will work but there can be pitfalls :-(

Looking at your diagram I would expect it to work - but I've never tried to build anything like that.

Bob
This topic is locked and no more replies can be posted.