Get all field values from app
AnsweredHello,
what Is the best way to obtain field values from all items of a single app?
So, I have f.e.
id | qty | price
------+---------+---------
1 | 24 | 13.50
2 | 14 | 11.20
3 | 41 | 23.50
And I want to have in array
1 => 24
2 => 14
3 => 41
What is the best way?
-
Hi Marian,
Use Filter Items to get all your items out https://developers.podio.com/doc/items/filter-items-4496747 and then you just have to loop over the collection and find the value for each field.
All the best,
Andreas -
Oh... aaaaaand
When I use filter.. this filter gets me incredible long object
F.e. I want to obtain all ids of apps that created items
I use Podio filter to filter all items from single app
I want now to obtain created by -> app id from every item
So I'd like to have
array (
[0] => 3122089;
[1] => 3122089;
[2] => 3122085;
);
that means that item 0 was created by app 3122089, item 1 by 3122089 etc.
Hope I'm clear.
The structure is very wide..
f.e to get this id ..
Array
(
[0] => PodioItem Object
(
[__attributes] => Array
(
[item_id] => 33062928
[external_id] => 246
[title] => Mac
[link] => https://xxx.podio.com/customer-support/item/33062928
[rights] => Array
(
[0] => add_task
[1] => subscribe
[2] => comment
[3] => update
[4] => delete
[5] => add_file
[6] => view
[7] => add_conversation
[8] => rate
)[initial_revision] => PodioItemRevision Object
(
[__attributes] => Array
(
[revision] =>
[created_on] => 2013-02-07 10:45:42
[created_by] => PodioByLine Object
(
[__attributes] => Array
(
[type] => app
[id] => 3122089 <--herehow to get this kind of array smarter than going through array's object's array
-
You have an instance of the PodioItem class so you can use the methods and properties on that class. To find the created_by for the initial revision:
// Provided that your item is in the $item variable
$created_by = $item->initial_revision->created_by;
// $created_by is an instance of PodioByLine class, so you have those properties. Just print the ID:
print $created_by->id;
Please sign in to leave a comment.
Comments
6 comments