editor.where the filename doesn't seem to allow formulas

editor.where the filename doesn't seem to allow formulas

alexandr.yulalexandr.yul Posts: 3Questions: 2Answers: 0

Looking at https://editor.datatables.net/manual/php/conditions#Complex-usage, all the document and support examples use the entire field name in the first argument. What if I want to use only part of the field name?

Example:
A date field in which I want to compare just the year portion to a value,
LEFT(expenses.exp_dt, 4) = "2017"
or YEAR(expenses.exp_dt) = "2017"

Any ideas?

Answers

  • allanallan Posts: 61,642Questions: 1Answers: 10,092 Site admin

    This should do it:

        ->where( function ($q) {
            $q->where( 'YEAR(expenses.exp_dt)', '2017' );
        } )
    

    It isn't explicit documented that you do that yet, as I'm still working on aspects of functions in the first parameter, but that one will work no problem (just tested locally).

    Allan

This discussion has been closed.