Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

filemaker.php.. refer to each table as separate object?


This topic is 5839 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

hello..

so, i'm making my way (stumbling through) using the Filemaker API.. and i'd like to clarify something in my head before i get to used to the idea, in case it's the 'wrong' way.

:o I thought i could get a related field from the "Meeting" table field by doing:


define ('FM_HOST', '127.0.0.1');

define ('FM_FILE', 'rxworldwide');

define ('FM_USER', '******');

define ('FM_PASS', '******');



include ('Filemaker.php');



###### CONNECT TO DATABASE

$fm = new FileMaker (FM_FILE, FM_HOST, FM_USER, FM_PASS);



###### GET ATTENDEE RECORD

$attendee = $fm->getRecordById('Attendee Setup', NULL);  // i'll fix the null thing later



##### GET MEETING RECORD

$meeting = $fm->getRecordById('Meeting Setup', NULL); // ditto





Originally, i had a "Web" layout containing fields from both the Attendee table and related fields from the Meeting table.. but i couldn't get the related fields to appear on the web.



Now, to pull an attendee field.. i just:




<?php echo $attendee->getField('attendee name') ?>




And to get a meeting field on the same page.. i'm doing:




<?php echo $meeting->getField('meeting name') ?>




It's working this way (above), but i wanted to make sure i wasn't developing any bad habits right out of the gate. 
<?php echo $attendee->getField('Meeting::meeting name') ?>

no dice.. i don't know if it's not /supposed/ to work that way, or if i'm just thinking about this all wrong(?).

any guidance would be greatly appreciated. :)

Posted (edited)

see my other post . The short of it is that a you need to use the 'relationship name' i.e. the name of the Table Reference in FMP's relationship graph which my not be the same as the Table name.

Also if your related table is in a portal you will need to grab the related set before you can access the fields. (even if the portal just contains one row.)


$relatedRecords = getRelatedSet('relationship_name');

Will return an array of Filemaker_Record Objects that you can loop through and grab fields from;

Edited by Guest

This topic is 5839 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.