Post

4 followers Follow
0
Avatar

How do I get items with a filter on dates?

Hi,

I am using the API to fetch Podio items. The PodioItem::filter() function works great for that with filters like the one below. Is there a way I can filter on date, let's say the 'Created on' date? That date is not a field so I don't know how to specify it.

$issueItems = PodioItem::filter($app_id, array(

'filters' => array(

$statusField_id => array($status_notStarted,$status_developmentStarted,$status_developmentDone)

, //Filter on status 

'sort_by' => 'created_on',

'limit' => 200

));

Louise Mattsson Answered

Please sign in to leave a comment.

12 comments

1
Avatar

You can see all the options for filters at https://developers.podio.com/doc/filters -- the date options are at the bottom and the special cases such as created on date are at the top.

Some examples with the PHP client and created_on:

// Absolute date

$collection = PodioItem::filter($app_id, array('filters' => array('created_on' => array('from' => '2011-01-01', 'to' => '2011-02-01'))));

// Relative date. Everything created in the past week

$collection = PodioItem::filter($app_id, array('filters' => array('created_on' => array('from' => '-1w', 'to' => '+0dr')))); 

Andreas Haugstrup Pedersen 1 vote
Comment actions Permalink
0
Avatar

Hello, how can I get the current week using this array('from' => '-1w', 'to' => '+0dr')? please. thanks

Victoria Aparicio 0 votes
Comment actions Permalink
0
Avatar

Victoria, could you please elaborate on what you're trying to achieve?

Andreas Garnæs 0 votes
Comment actions Permalink
0
Avatar

Hello Andreas, I want to get a report, so I want to get items that where created in the current week.

Victoria Aparicio 0 votes
Comment actions Permalink
0
Avatar

I'm trying to do this

$leads = PodioItem::filter(12963593, array(
'filters' => array(
$app_reference_field_id => array($filter_target_item_id),
$date_lead_created => array(
'from' => '-1w', 'to' => '+0dr' // but this option got the items that where created in the last week until today, I don't want it
)
),
));

Victoria Aparicio 0 votes
Comment actions Permalink
0
Avatar

Victoria, please try this:

"from" => "-1dr", "to" => "-1dr"
Andreas Garnæs 0 votes
Comment actions Permalink
0
Avatar

that condition doesn't get the date "06/10/2015", I wan to get the item of the current week

Victoria Aparicio 0 votes
Comment actions Permalink
0
Avatar

Ah, sorry I got that wrong. Please try this instead:

"from" => "+0wr", "to" => "+0wr"
Andreas Garnæs 0 votes
Comment actions Permalink
0
Avatar

Hello, I have an issue, I want to get all the tasks using this filter
$val=PodioTask::get_all(array(

'due_date' => array(
'from' => date('Y-d-m') , 'to' => date('Y-d-m')
),
'completed' => 'false',
'responsible' => 2565874 ,
'space' => 3806872,
'grouping' => 'due_date',
'offset' => 0,
'limit' => 100
));

I got this error
"The values are not in the right format"

Victoria Aparicio 0 votes
Comment actions Permalink
0
Avatar

Victoria, please ensure that the dates are in the format YYYY-MM-DD.

Andreas Garnæs 0 votes
Comment actions Permalink