[mapguide-users] query code help...

lolob azzam_wahab at hotmail.com
Wed Jan 23 01:47:49 EST 2008


hi,
I need help with the code here..I want to create query that can use 3
property...for example...i want to filter something like this "FIELD = apple
and STATE = state1 and AREA >= 1000 "...the question is how do I combine the
statement and send to $propertyFilter...and how to add the logic 'AND'
statement here...

thanks..

>From sample version
$queryOptions = new MgFeatureQueryOptions();

if ($this->args['USEPROPERTYFILTER'] == 'true')
{
   $propertyFilter = $this->args['PROPERTYNAME'];

   if ($this->args['ISSTRING'] == 'true')
	$propertyFilter .= sprintf($this->strExpressions[$this->args['OPERATOR']],
$this->args['VALUE']);
   else
	$propertyFilter .= sprintf($this->numExpressions[$this->args['OPERATOR']],
$this->args['VALUE']);

  $queryOptions->SetFilter($propertyFilter);  
}


my version
if ($this->args['USEPROPERTYFILTER'] == 'true')
{
   $propertyFilter1 = $this->args['PROPERTYNAME'];
   if ($this->args['ISSTRING'] == 'true')
	$propertyFilter1 .=
sprintf($this->strExpressions[$this->args['OPERATOR1']],
$this->args['VALUE1']);
   else
	$propertyFilter1 .=
sprintf($this->numExpressions[$this->args['OPERATOR1']],
$this->args['VALUE1']);
   
   $propertyFilter2 = $this->args['PROPERTYNAME'];
   if ($this->args['ISSTRING'] == 'true')
	$propertyFilter2 .=
sprintf($this->strExpressions[$this->args['OPERATOR2']],
$this->args['VALUE2']);
   else
	$propertyFilter2 .=
sprintf($this->numExpressions[$this->args['OPERATOR2']],
$this->args['VALUE2']);

   $propertyFilter3 = $this->args['PROPERTYNAME3'];
   if ($this->args['ISSTRING'] == 'true')
	$propertyFilter3 .=
sprintf($this->strExpressions[$this->args['OPERATOR3']],
$this->args['VALUE3']);
   else
	$propertyFilter3 .=
sprintf($this->numExpressions[$this->args['OPERATOR3']],
$this->args['VALUE3']);


 
$queryOptions->SetFilter($propertyFilter1.$propertyFilter2.$propertyFilter3);  
}
-- 
View this message in context: http://www.nabble.com/query-code-help...-tp15035839s16610p15035839.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list