Buy Now
Sign in

Get array of one field's values from read data action

healyhatman
I'm annoyed that I just worked this out, since I've made a whole bunch of forms and connections where I've used a PHP action to make an array, and I needn't have bothered.
Let's say you use a read data action to get all of the articles on your site, and you want an array of just the article id's . Maybe your read data action gets all the articles after a certain date, and you want a second read data action to get all the articles NOT in the first read data action.
{var:read_data#.[n].model.field}
===============================================
Array
(
[read_data29] => Array
(
[log] => Array
(
[0] => SELECT `user`.`id` AS `user.id` FROM `##_users` AS `user` LIMIT 100;
)

[var] => Array
(
[0] => Array
(
[user] => Array
(
[id] => 558
)

)

[1] => Array
(
[user] => Array
(
[id] => 559
)

)

)

)

)
Using {var:read_data29.[n].user.id} gives me ["558","559"]
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
C
Crams
This is awesome, you made my day! how did you get to the [n] parameter? do you know if there's a way to use a wildcard or a variable?
healyhatman
I got it from this post
https://www.chronoengine.com/forums/posts/t105619/p377969/chart-widget-how-to-calculate?startat=0
I had never seen it before, haven't seen it since, didn't see it in any of the FAQs or manuals.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman