[FX.php List] Stupid Find Question

Greg Lane glane at moyergroup.com
Mon Dec 20 00:56:51 MST 2004


Marisa,

As far as I can tell, a logical "or" query only works when different 
fields are specified. The WPE doesn't seem to offer a syntax for 
specifying multiple find requests for a single field.

One way to work around this is to define a global text field "gTemp" 
with a relationship to unitid. Then create an FM script "FindIDList" as 
follows. The script needs to check for the condition where no related 
records are found, otherwise the script would return all records in the 
table.

	Go to Layout [ "Globals" (Unit) ]
	If [ IsEmpty(Unit::unitid) ]
		Go to Layout [ "Web" ]
		Show All Records
		Show Omitted Only
	Else
		Go to Related Record [ From table: "Unit"; Using layout: "Web" (Unit) 
] [ Show only related records ]
	End If

Make certain the gTemp field is present on the layout specified in 
SetDBData. The following code will populate the global "gTemp" with a 
return-delimited list of values, perform the "FindIDList" script, and 
return the corresponding record set.

	include ("FX/FX.php");
	$request = new FX ("127.0.0.1", "80", "FMPro7");
	$request->SetDBData('DB', 'Web');
	$request->AddDBParam('gTemp.global', "15\r20");
	$request->AddDBParam('-script.presort', 'FindIDList');
	$result = $request->FMFindAny();

Note: the global field is named "gTemp" but it must be specified as 
"gTemp.global" for the WPE to handle it properly. Also, if you expect 
more than 50 records in the result set be sure to specify an 
appropriate group size for the third parameter of SetDBData. For some 
reason when I specify "All", FX.php doesn't return any records with the 
above script even though the generated URL does return records.

Greg


On Dec 18, 2004, at 10:19 PM, Marisa Smith wrote:

>
> OK, I KNOW I should know how to do this, but I can't figure it out
>
> I need to find all records whose unitid=15  OR  whose
> unitid=20
>
> In Filemaker client, I can do this with a 'new request', but I don't 
> know
> the equivalent in XML.  I tried this:
>
>     $AAHRPPDocQuery->AddDBParam("unitid","15");
>     $AAHRPPDocQuery->AddDBParam("-lop","or");
>     $AAHRPPDocQuery->AddDBParam("unitid","20");
>
> But I end up with an error 401.
>
> What am I missing here?  Or am I trying to do the impossible?



More information about the FX.php_List mailing list