July 26, 200421 yr Newbies Hi everybody, I'm having a big problem in my work. I need to publish databeses using FX.php. I'm abble to connect the database, check data but I can't access to the linked fields of my database. I've checked that all tables where shared on the web with FM companion but when I try to access to a field linked using relatonship The field appear empty. Here is my code (based on the exemples of FX) $BushingQuery = new FX($serverIP, $webCompanionPort); $BushingQuery->SetDBData("Bushing request.fp5"); $arrayName = 'HTTP_' . $HTTP_SERVER_VARS["REQUEST_METHOD"] . '_VARS'; if (${$arrayName}['currentSort'] != '') { $BushingQuery->AddSortParam($HTTP_GET_VARS['currentSort']); } if (${$arrayName}['currentQuery'] == 'search orders') { foreach ($$arrayName as $key => $value) { if ($key != 'currentSort') { $BushingQuery->AddDBParam($key, $value); } $currentSearch .= '&' . "$key=" . urlencode($value); } $BushingData = $BushingQuery->FMFind(); } else { $currentSearch = ''; $BushingData = $BushingQuery->FMFindAll(); } $counter = 1; if ($BushingData['foundCount'] > 0) { foreach ($BushingData['data'] as $key => $value) { $recordID = strtok($key, '.'); ------------------------------------------------------------------- $value['Revision'][0]; (Work to call a field) $value['STATUS::CUSTOMER'][0]; (Doesn't work for a linked field) ------------------------------------------------------------------- } } My relationship's name is STATUS and my field's name is CUSTOMER. Regarding to the documentation it is supposed to work ... I'm really disapointed with this problem. If someone could help me :grin: ... If someone has an exemple of the way he can access to related fields using fx.php, please post it : Thank you all for your help
July 26, 200421 yr Howdy from Texas! I have included a snippet of some working code which I use for a WAP/WML solution I have created for bringing Filemaker data to my mobile users. It includes reference to a field through a relationship. A point to note (which you may already be aware of) is that your fields should appear on your layout that the query is referencing. I notice that your SetDBData line does not specify a layout. Your SetDBData line reads: $BushingQuery->SetDBData("Bushing request.fp5"); and should probably be something like: $BushingQuery->SetDBData("Bushing request.fp5", "name-of-your-layout"); I normally create a specific layout for my web services which includes all (local and related) fields I expect to reference. In my case below, the layout name in the file "schedule.fp5" is "web". - - - - - - - - - - include ("FX/FX.php"); include ("FX/prefs.php"); // Schedule Mode - Client passed $worksched in URL if (isset($_REQUEST[ 'worksched' ])) $mode = 'schedule'; // Set up the query $SchQuery = new FX($FMAddress, $FMPort); $SchQuery->SetDBData ('schedule.fp5', 'web', 999); $SchQuery->SetDBPassword ($syspassword, $sysusername); $SchQuery->AddDBParam ('SchedDate',$worksched,'eq'); $SchQuery->AddDBParam ('RecordType', 'Labor', 'eq' ); // Get the data $SchResult = $SchQuery->FMFind(); echo "Returned from query...Found = " . $SchResult['foundCount'] ."<br/>n"; // If we returned data, iterate through the found set. if($SchResult['foundCount'] > 0) { foreach($SchResult['data'] as $CRecord){ echo $CRecord['PO_Nbr'][0] . " - "; echo $CRecord['Main::ContactName'][0] . " - "; echo $CRecord['InstallType'][0] . " - "; if ( $CRecord['Installer'][0] == "" ) { echo "N/A"; } else { echo $CRecord['Installer'][0]; } echo "<br/>n"; } } else echo "<br/>No Jobs Found<br/>"; - - - - - e n d o f s n i p p e t - - - - - - - - - - - - - - regards... Bob Minteer CTO / IT Manager Cooper Flooring, LTD.
July 27, 200421 yr Author Newbies Yaouuuuuuuuuu Minteer I would like to thank you a lot. The problem was due to the layout. I didn't specified any layout and that's why the related links were not working. I'm now able to do what I need so thank you -) See you
Create an account or sign in to comment