CF7- Read Data - php conditions

Create complex OR conditions or test for values in an array in ChronoForms.

Overview

The issue arises when trying to use advanced PHP conditions, like IN clauses or OR logic, within the Read Data action, which is not directly supported.
Instead of using PHP conditions, use the SQL Data action to write a full custom query or, in v8, use the Where behavior to define your own WHERE clause directly.

Answered
ChronoForms v7
ma mayergreenberg259 07 Mar, 2024
In cf7, in the read data action, how do I make a complicated condition:
I understand how to make a simple condition where I just test for "=" or "!=". It look like this ["Table.Column", "TestValue" , "="].
But how do I test if the Table.Column value is in an array of values? Like this: ["Table.Column", "TestValue1, TestValue2" , "IN"] ?
It doesn't work. Can someone show me how to make it work?

Also, when returning the array of conditions, they are all 'AND'. How do I make them 'OR'?
Max_admin Max_admin 07 Mar, 2024
you can use the SQL data action, and in v8 you can also write the WHERE part of the query directly
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin Max_admin 07 Mar, 2024
you should use the returned data using the variable as the data source for the table view:
{var:sql_data_name}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ma mayergreenberg259 08 Mar, 2024
Back to the original question:
Once I am using the php conditions, how can I make the conditions into 'OR'?
Max_admin Max_admin 16 Mar, 2024
Answer
do not use PHP conditions, use SQL Data action or v8 "Where" behavior

for SQL Data you can write the full query however you want

for v8 Where you can write your own where query
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.