Jump to content

Empty Related Data Returns Error with FX.php


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

Recommended Posts

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?

Link to comment
Share on other sites

This topic is 7106 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.