WHERE statement in CF7

How to build a WHERE statement in ChronoForms 7.

Overview

The issue is confusion over the correct PHP syntax for returning conditional WHERE statements in CF7's read data action.
Use PHP code in the conditions field to return an array in the format: return [["field", "value", "="], "AND/OR", ["field2", "xxx", "!="]];. Note that the operator should be a single "=", not "==".

Answered
ChronoForms v7
ie ieraora 09 Mar, 2022
Hi. At this link we have instruction for WHERE Statement in CF / CC 5.
https://www.chronoengine.com/faqs/72-chronoconnectivity/ccv5/5215-how-do-i-build-a-where-statement-in-ccv5
But in CF7?
In read data I read this note:
PHP code without tags to return an array of conditions, e.g: return [ ["field_1", 1, "="],["field_2", 2, "!="]];

Ok, But this code, that I read in previous faq:

return array (":model.column = 'value' OR model.column_2 = 'value_2'");

what syntax has in CF7?

and this?

return array( 'model_id.column' => array('some value', 'another value', . . . ) );

Thank you for your reply.
Max_admin Max_admin 11 Mar, 2022
The Where conditions setting in v7 is advanced enough, why do you need to use PHP ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin Max_admin 13 Mar, 2022
Hi,

If you want to have conditional conditions as posted by email, then you need PHP, the conditions should be in this format:
return [["field", "value", "=="], "AND", ["field2", "xxx", "!="]];
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ie ieraora 13 Mar, 2022
Answer
Ok, thank you, to be precise is:

return [["field", "value", "="], "AND", ["field2", "xxx", "!="]]; With "==" don't work.

So, for my work is

return [["field", "value", "="], "OR", ["field2", "xxx", "!="]];

Can I suggest to change description in read data (PHP code without tags to return an array of conditions, e.g: return [["field_1", 1, "="],["field_2", 2, "!="]];) ??

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