Showing rows only from specific users

Showing rows only from specific users

TMRTMR Posts: 7Questions: 3Answers: 0
edited April 2016 in Free community support

Hi All,

Pulling my hair out over this one 8-) I'm using datatables that are used by a lot of users, I need to only show rows from specific users. So figure I need a WHERE condition:

$editor->where( 'EquipmentCatsCompanyID', '+companyidpassedfromform+' );

I need to get it into here but haven't got a clue where to put it. I've tried all options but they end up with errors:

Editor::inst( $db, 'vehiclecats', 'VehicleCatsID' )// VehicleCatsIDis the primary key
    ->fields(
        Field::inst( 'VehicleCatsCompanyID' ),
        Field::inst( 'VehicleCatsName' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'VehicleCatsDesc' ),
        Field::inst( 'VehicleCatsDateAdded' )
            ->validator( 'Validate::dateFormat', array(
                "empty"   => true,
                "format"  => Format::DATE_ISO_8601,
                "message" => "Please enter a date in the format yyyy-mm-dd"
            ) )
            ->getFormatter( 'Format::date_sql_to_format', Format::DATE_ISO_8601 )
            ->setFormatter( 'Format::date_format_to_sql', Format::DATE_ISO_8601 )
    
    )

    ->process( $_POST )
    ->json();

Can anyone help please?

Answers

  • TMRTMR Posts: 7Questions: 3Answers: 0

    DUH...!!!

    I got it, just in case anyone else needs it, it's even simpler than I'd thought (...bashes head against the wall...) - heres the working example:

    Editor::inst( $db, 'vehiclecats', 'VehicleCatsID' )// EquipmentCatsID is the primary key
        ->fields(
            Field::inst( 'VehicleCatsCompanyID' ),
            Field::inst( 'VehicleCatsName' )->validator( 'Validate::notEmpty' ),
            Field::inst( 'VehicleCatsDesc' ),
            Field::inst( 'VehicleCatsDateAdded' )
                ->validator( 'Validate::dateFormat', array(
                    "empty"   => true,
                    "format"  => Format::DATE_ISO_8601,
                    "message" => "Please enter a date in the format yyyy-mm-dd"
                ) )
                ->getFormatter( 'Format::date_sql_to_format', Format::DATE_ISO_8601 )
                ->setFormatter( 'Format::date_format_to_sql', Format::DATE_ISO_8601 )
        
        )
                ->where( 'VehicleCatsCompanyID', 1 )
        ->process( $_POST )
        ->json();
    
This discussion has been closed.