[FX.php List] Find record using 'date'

Erik Andreas Cayré erik at cayre.dk
Wed May 9 10:09:41 MDT 2007


Den 09/05/2007 kl. 11.20 skrev Roger Price:

> Just when I thought I was getting the hang of this...
>
> I have an FMP date field 'dd/mm/yyyy' and want to do a find between  
> a range of dates. It works when in native Filemaker but I get a  
> zero 'foundcount' when I use FX.php.
>
> Is there some trick to this?

Well there *is* a way (not really trick):

The following is a simplified copy of a function I use for the  
purpose you described: finding a date range

// Find sold products by selected year, without 'InnerArray'
	function getSoldProducts ($year)

{
		global $fmshost;
		global $dataport;
		global $dbname;
		global $user;
		global $pass;
		global $errorsList;
		
		$dateInterval = '1/1/' . $year . '...' . '12/31/' . $year;
		
		$layout = 'www_soldproducts';
		
		$fx = new FX($fmshost, $dataport);
		$fx->SetDBData($dbname, $layout, 'All');
		$fx->SetDBUserPass($user, $pass);
		$fx->AddDBParam('datesold', $dateInterval);

		$return_data = $fx->FMFind(TRUE, 'full', FALSE);
		
		if (!in_array($return_data['errorCode'], array('0', '401')))
		{
			reporterror ('Stats:Productsearch:FMP error: ' . $errorsList 
[$return_data['errorCode']]);
			return (FALSE);
		}
		
return (TRUE);
}

The $dateinterval variable is where I build the query to go into FX...

Just ask if this is not clear enough


---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
DK-6705 Esbjerg Ø

Home Tel: +45 75150512
Mobile: +45 40161183

»Interest can produce learning on a scale compared to fear as a  
nuclear explosion to a firecracker.«
--Stanley Kubrick

»If you can't explain it simply, you don't understand it well enough.«
-- Albert Einstein

»If you don't have time to do it right, when will you have time to do  
it over?«
-- John Wooden, basketball coach




More information about the FX.php_List mailing list