October 27, 200916 yr Hi All, How can insert an array into a field? Is this possible? Or if not, How can I insert the array's data into the filemaker field? thanks RB
November 17, 200916 yr Hi WingMaker, 1) Depends on the complexity of the array. 2) Depends if you want it to be human readable or are just using it for storage purposes. If you just wanted to store the array values for example to be used again later: 1) To Store $array = array("Item 1","Item 2","Item 3"); $storeArray = implode("n",$array); . . . $myEditCmd->setField('array',$storeArray); $myExitCmd->execute(); 2) To Retrieve $storeArray = $record->getField('array'); $array = explode("n",$storeArray); If you had a more complicated array and wanted to store it and retrieve it the easiest way would be as follows: $array = array( 51255=>array("FirstName"=>"Alex","LastName"=>"Babkov","CallSign"=>"Alex Babkov"), 99124=>array("FirstName"=>"Bob","LastName"=>"Hawke","CallSign"=>"Primey") ); $storeArray = base64_encode(serialize($array)); And to retrieve: $storeArray = $record->getField('array'); $array = unserialize(base64_decode($storeArray));
Create an account or sign in to comment