Forums

Read Data action. filter with SQL WHERE (How to ignore field_name = {data.quote:parameter} when parameter is empty

simelas 07 Nov, 2024

Hi Max, hi all,

Read Data action.

in previous chronoforms/chroconnectivity versions, when using several filters, empty parameter could be ignored in the SQL  WHERE statement  by using  field_name = {data:parameter}/-   .

In CF8 the syntax is field_name = {data.quote:parameter}. How do you achieve the same result as previous CF/CC with CF8 ( ignore empty parameter in SQL WHERE statement ) ?     Using field_name = {data.quote:parameter}/- give an error.

best,

Max_admin 08 Nov, 2024
Answer

Hi simelas

This is not supported in v8, but I have added support for PHP in WHERE statement and SQL behaviors, so that you can use something like this:

id = 1 <?php if(!empty($this->data("fieldname"))): ?> OR column = {data:fieldname} <?php endif; ?>

However, you need to get the new update for this to work, I'm trying to have it ready this weekend, or do you prefer a quick patch for this fix only ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
simelas 08 Nov, 2024

Hi Max,

Thanks fro the info. Yes please a quick patch would be welcome. 

another question then : will the php where accept also  -- return [ ["field_1", 1, "="], ["field_2", 2, "!="] ];  --  as in in CF7 ?

S. 

Max_admin 11 Nov, 2024

Hi simelas

Please update the new v8.0.24 update, it has this fix

And the v7 conditions are not supported in v8, you can use your own SQL in v8 so the old way is not needed

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.