AnsweredAssumed Answered

Working with CWP RelatedSet Arrays

Question asked by Malcolm on Aug 12, 2013
Latest reply on Aug 13, 2013 by Malcolm

I have the code below. At the point that I call the getFields() method on the related set object I get a fatal error. I can't see why $rset is regarded as a non-object.

 

$relatedsets = $layout->listRelatedSets();

foreach ($relatedsets as $rs) {

$rset = $record->getRelatedSet($rs);

if (FileMaker::isError($rset)) {

echo "Error: " . $rset->getMessage() . " ";

exit;

}

 

$field_data = $rset->getFields();

// PHP Fatal error: Call to a member function getFields() on a non-object

 

}

 

To confirm this the function is_object($rset) returns false but getRelatedSet is meant to return an FileMaker Record Object. It certainly looks like it when I use print_r($rset) to inspect the result visually I see this:

 

Array

(

[0] => FileMaker_Record Object

(

[_impl] => FileMaker_Record_Implementation Object

 

Any clues to where I am going wrong with this?

Outcomes