简体   繁体   中英

Podio PHP API - Filter item collection by calculated field value

I have a calculated field with external id has-email which populates with the value 1 if the item's email address is not empty (and 0 if it is).

$filters = array (
    'has-email' => 1
);

$attributes = array (
    'filters'       => $filters
);

$collection = PodioItem::filter( $app_id, $attributes );

I'm trying to get a collection of items which includes only those with an email address (where the value of has-email is 1 ), however, this returns the error Podio Error Invalid value 1 (integer): must be object . How can I filter on calculated field value?

You should pass the value as an array with from and to keys. Also please make sure the Calculation field has-email 's value in Podio is a number (not a string).

The below code will return the items where the value of has-email is 1

$filters = array(
    'has-email' => array(
        'from' => 1,
        'to' => 1
    )
);

and the below code will return the items where the value of has-email is 0

$filters = array(
    'has-email' => array(
        'from' => 0,
        'to' => 0
    )
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM