Filter Date range

Elita- Elita- 27 Jan, 2021
Hi, struggling with the right syntax for Filter that would use two datepicker fields and returns filtered data for Connectivity6 table:
​
1st datepicker name - fromFilter
2nd datepicker name - toFilter
​
what should be the right PHP code for Read_data function
if this code works for those fields separately?
​
if (!empty($fromFilter)) {
echo 'Submission.izpildes_datums/>=:{data:fromFilter}';
}
?>
​
if (!empty($toFilter)) {
echo 'Submission.izpildes_datums/<=:{data:toFilter}';
}
?>
​
​
What is the right synatx for AND operator in PHP Rules list for data_read function?
​
Or how can I build the WHERE condition using CCv6 built-in Conditions and Operators considering that I need to check if field is not empty and ONLY if it is not empty proceed with where function?
​
Thanks!
Firstly I need the solution for CCv6, however it would be good to know if there are differences between CCv6 and CF7 in this.
​
Thanks for reading this and many thanks for the solution -
Elita
​
P.S. Sorry for the wrong tag; it should be Connectivity6 and Chronoforms7
Elita- Elita- 27 Jan, 2021
Its crazy, but I figured it out -
​
echo
(
'Submission.izpildes_datums/>=:{data:fromFilter}
AND
Submission.izpildes_datums/<=:{data:toFilter}'
)
​
exactly how it is written - with AND and parentheses in separate lines. And WITHOUT curly braces!
Elita- Elita- 27 Jan, 2021
After couple of hours try and trial I have figured out the code above;
​
What if I needded to add third field?!?!?!? What would the code looked like?
​
if (!empty($noFilter)&&($lidzFilter))
echo
(
'Submission.izpildes_datums/>=:{data:noFilter}
AND
Submission.izpildes_datums/<=:{data:lidzFilter}'
)
AND
else if (!empty($atbildigaisFilter))
echo
'Submission.atbildgais_uzdevums/like:%{data:atbildigaisFilter}%'
​
seems not to be working...😟 got an error SYNTAX ERROR, UNEXPECTED 'ELSE' (T_ELSE)
This topic is locked and no more replies can be posted.