Author Topic: remote filtering for between condition on dates  (Read 1649 times)

mewbie

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 33
    • View Profile
remote filtering for between condition on dates
« on: January 07, 2018, 07:53:27 pm »
Got a progress on date filter,
I add following code to my php endpoint:

Quote
            else if ($condition == "lte")
            {
                $fc[] = $dataIndx . " <= ?";
                $param[] = $text;                                                               
            }
            else if ($condition == "gte")
            {
                $fc[] = $dataIndx . " >= ?";
                $param[] = $text;                                                               
            }
            else if ($condition == "between")
            {
                $fc[] = $dataIndx . " >= ?";
                $fc[] = $dataIndx . " <= ?";
                $param[] = $text;                                                               
            }

but I still can't make $condition == "between" to work, any idea?
..and after that still 2 more to go..  ;D

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: remote filtering for between condition on dates
« Reply #1 on: January 08, 2018, 02:57:09 pm »
I've updated PHP script for between condition in this example: https://paramquery.com/pro/demos/filter_header


Code: [Select]
             else if ($condition == "lte")
            {
                $fc[] = $dataIndx . " <= ?";
                $param[] = $value;                                               
            }                       
            else if ($condition == "gte")
            {
                $fc[] = $dataIndx . " >= ?";
                $param[] = $value;                                               
            }                       
            else if ($condition == "between")
            {
                $fc[] = "(" . $dataIndx . " >= ? and ".$dataIndx." <= ? )";
                $param[] = $value;                                               
                $param[] = $filter->value2;                                               
            }