Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empty Related Data Returns Error with FX.php

Featured Replies

After a day of debugging I've found my problem. But it shouldn't be a problem, and I'm wondering if others are facing the same issue.

I have a layout/table for Jobs (called WebOneJobOK). Each job has and Architect, stored as a number. The Architect number is used to relate to a table called Architect, which has the related info for the architect -- name, phone, etc. This is really straightforward relational DB theory, and works fine within FileMaker.

The problem comes when I access this data via FX.php. Suppose the layout has 3 fields: JobNumber, Architect, and Architect::Name. I perform a find based on the job number

$userOneJob = new FX($FMAddress, $FMPort);

$userOneJob -> setDBUserPass('WebUser' , $FMPassword);

$userOneJob -> setDBData('CabiNet.fp7' , 'WebOneJobOK');

$userOneJob -> AddDBParam('WSJobNumber' , $jobNumber, 'eq'); // Job number has been converted to a php field, $jobNumber.

$userOneJobResult = $userOneJob -> FMFind();

echo "<pre>nn";

print_r ($userOneJobResult);

echo "</pre>nn";

If the job has an Architect specified, everything works fine. But if the field is empty, I get an error message:

FX_Error Object

(

[error_message_prefix] =>

[mode] => 1

[level] => 1024

 => 100

[message] => FX: ExecuteQuery XML error: XML_ERR_DOCUMENT_END at line 2

[userinfo] =>

[backtrace] => Array

(

[0] => Array

(

[file] => c:inetpubwwwrootCabiNetFXFX.php

[line] => 889

[function] => FX_Error

[class] => FX_Error

[type] => ->

[args] => Array

(

[0] => ExecuteQuery XML error: XML_ERR_DOCUMENT_END at line 2

)

etc....

So it is a problem with the xml result, but not one I can readily decipher.

However, if I take Architect::Name off the layout, everything works fine, even if Archietct is empty. I just get the correct array with that data empty. The workaround I have is to create a calc field within Jobs -- ArchitectName = Architect::Name. I can put this on the layout and it works OK, empty or not. But I thought I had left this kind of trickery behind with FM6.

Anyone have any ideas on why empty related data is causing the error? I guess I can live with the workaround, but I'd rather not have to.

Thanks,

Dan

PS - one more thing I just tried. If I put Architect::Name in a 1-line portal rather than just directly on the layout, it works fine, empty or not. Weird. I guess I'd rather do this than create many calc fields as a work around.

Any thoughts?

  • Author

One more thing. This must be a problem with FM, not FX.php, because if I bypass FX and just shoot the raw url to FM, I get the same kind of error.

  • Author

One More One More thing...

Empty related data seems to work fine on other layouts...

It sounds similar to a problem we had a few years ago with CDML. Unfortunately, I can't remember the details of it :

Good Luck.

Garry

  • Author

Thanks, Garry. I'm glad to know when I'm not just talking to myself. I've submitted it to FM, referencing this thread in my bug report. We'll see what happens.

Best,

Dan

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.