Using pre/post save helper with Pick columns

0

Can anyone show me an example of how to set pick column(releated to other pod) using a pre/post save helper. Thanks in advance

asked Sep 13 '10 at 3:40

Ayush

1

add comment
enter at least 15 characters

4 Answers

0

<?php $columns['column_name_here']['value'] = 4; // this will set the pick column value to the related pod item of ID 4

answered Sep 13 '10 at 4:45

sc0ttkclark

2936

add comment
enter at least 15 characters
0

hey scott consider this example, the persons pod & the dates pod have a multiselect column each defined in them which is bidirectional to each other

person pod --> date(multiselect pick column) date pod --> person(multiselect pick column)

as of now i know the date ids that are created so just entering them manually in the pick field value for the multiselect

but this is not happening my syntax & code maybe wrong so lookin for help there

$api = new PodAPI();

$columns['name'] = testing1234;
$columns['date']['id'] = array(1,2);

$params = array('datatype' => 'persons', 'columns' => $columns);


$id = $api->save_pod_item($params);

Generally i though of fetching the date pod id's & then using them for the above code. what if i enter a id for the date pod which does not exist as a pod item, will it be created by itself like is there a way to do that that if the pod item does not exist then create it n them associate the respective id for the above relation?

please could you help me with the code thanks!

answered Sep 18 '10 at 11:32

acenik

1

add comment
enter at least 15 characters
0

Try this:

$api = new PodAPI();

$columns['name'] = testing1234;
$columns['date']['value'] = '1,2';

$params = array('datatype' => 'persons', 'columns' => $columns);

$id = $api->save_pod_item($params);

answered Sep 19 '10 at 9:24

sc0ttkclark

2936

edited Sep 21 '10 at 1:40

hey scott i tried this same code above got an error: SQL failed; SQL: SELECT id FROM wp_pod WHERE datatype = 30 AND tbl_row_id = Array LIMIT 1; Response: Unknown column 'Array' in 'where clause' please not the pod item is always saved, but the multipick column doesnt show the values selected when checked by the manage content section? – acenik Sep 20 '10 at 11:33
Check now, I meant to not use an array there, it should be comma-separated. – sc0ttkclark Sep 21 '10 at 1:41
add comment
enter at least 15 characters
0

Scott I played around a little it works this way thanks, for your help! tc

$api = new PodAPI();

$columns['name'] = testing1234;
$columns['date'] = "1,2";

$params = array('datatype' => 'persons', 'columns' => $columns);

$id = $api->save_pod_item($params);

answered Sep 21 '10 at 8:05

acenik

1

edited Sep 21 '10 at 8:06

add comment
enter at least 15 characters