Forums

Or condition in where clause

webcrea 09 Oct, 2017
Hi,

In read_data in where conditions I have

fonds.notreSelection:{data:notre_selection}/-
fonds.published:{data:cbox_published}/-
fonds.sg_id:{data:select_sg}/-
fonds.natureProduit:{data:select_type}/-
fonds.natureProduit1:{data:select_type}/-
fonds.millesime:{data:select_mille}/-

and i would want something like this

fonds.notreSelection:{data:notre_selection}/-
fonds.published:{data:cbox_published}/-
fonds.sg_id:{data:select_sg}/-
fonds.natureProduit:{data:select_type}/- OR fonds.natureProduit1:{data:select_type}/-
fonds.millesime:{data:select_mille}/-

Do you nhave any idea please ?
thanks
Max_admin 10 Oct, 2017
1 Likes
Hi Christophe,

You can use different strings in the conditions box to build a complex query:

fonds.notreSelection:{data:notre_selection}/-
AND
(
fonds.notreSelection:{data:notre_selection}/-
OR
fonds.notreSelection:{data:notre_selection}/-
)


Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
webcrea 10 Oct, 2017
Thanks Max,

fonds.millesime:{data:select_mille}/-
AND
(
fonds.natureProduit:{data:select_type}
OR
fonds.natureProduit1:{data:select_type}
)

no /- at the end
webcrea 12 Oct, 2017
With this, it works but if 2 fields (natureProduit and natureProduit1) are not empty the data doesn't appear. The filter select_type is empty '' and only data with one field empty appears.

If I add /- an at the end error occurs

fonds.notreSelection:{data:notre_selection}/-
fonds.published:{data:cbox_published}/-
fonds.sg_id:{data:select_sg}/-
fonds.millesime:{data:select_mille}/-
AND
(
fonds.natureProduit:{data:select_type}
OR
fonds.natureProduit1:{data:select_type}
)

I need this AND (OR) doesn't work if select_type is empty.
Do you know what I mean?
Thanks
Regards
Max_admin 28 Nov, 2017
Hi Christophe,

Apologizes for the late reply here!

You can use PHP code in the conditions box in order to switch the returned active conditions.

Best regards
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.