Using OR Conditions in CCv5

How to use OR conditions in ChronoForms v5.

Overview

The issue arises when needing to check if a field matches one of multiple values, but the standard condition syntax only allows for direct comparisons.
For checking a single field against multiple values, use the "IN" operator with an array of values. For more complex OR conditions across different fields, use the "OR" key with nested arrays specifying each condition.

Answered
ra razlie 18 Feb, 2014
Hi,
Any one know how to do a OR conditions in conditions field ... I want to add conditions like this
<?php
return array(
  "session_profail" =>"06-06-2013",
  "type <>" => "",
  "status_borang" => "3",
  "lvl1" => "3",
  "lvl1" => "5"
);
?>
where lvl1 is either 3 OR 5 .. Anyone has idea?
wa warmbeach 29 Mar, 2014
See this post:

https://chronoengine.com/forums/posts/t94305.html
Max_admin Max_admin 29 Mar, 2014
Answer
Hi,

For this situation, the solution would be to use "IN", which can be achieved easily by providing array of values :

"lvl1" => array("3", "5")


But to have OR, you should use:


<?php
return array(
  "session_profail" =>"06-06-2013",
  "type <>" => "",
  "status_borang" => "3",
"OR" => array(array("lvl1" => "3"), array("lvl1" => "5"))
);
?>


But since its only 1 field then its better to use "IN", not "OR"

Regards,
Max
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.