WHERE NOT LIKE in editor select field

WHERE NOT LIKE in editor select field

OlanOlan Posts: 41Questions: 11Answers: 1
edited September 2014 in Editor

Hello,

I have a leftjoin like:

->leftJoin( 'city', 'city.id', '=', 'user.cityID') ->where('city.name', '%_us%', 'NOT LIKE')

I want to have only a dropdown list in the editor with cities without _us in the name
I have now:

fields: [ 
            {
                "label": "City",
                "name": "user.cityID",
                "type": "select"
            },

            {
                "label": "Name",
                "name": "user.name"
            }
        ]
    } );

Everything works but i still get the cities with _us in the list.

Hope someone can help me out with this.
Thanks!

Answers

  • OlanOlan Posts: 41Questions: 11Answers: 1
    edited September 2014

    I figured it out.
    I had:

    if ( ! isset($_POST['action']) ) {
    $data['Team'] = $db
    ->select( 'city', 'id as value, name as label' )
    ->fetchAll();
    }
    

    but with:

    if ( ! isset($_POST['action']) ) {
        $data['city'] = $db
            ->query( 'select', 'city' )
                    ->get( 'id as value, name as label' )
                    ->where( 'name','%_us%','NOT LIKE' )
                    ->exec()
                    ->fetchAll();
    }
    

    it works

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Hi,

    Great to hear you got this sorted out - thanks for the update.

    Regards,
    Allan

This discussion has been closed.