[mapguide-users] Filter on joined database values (was: invalid XML document)

irwan anakando at yahoo.com
Tue Jan 13 23:01:57 EST 2009




Kenneth Skovhede, GEOGRAF A/S wrote:
> 
> IIRC, something is broken, so you can't filter on a joined database.
> Instead, you can select keys from the database with an sql like this:
> select distinct key from table where somecolumn = 'somecriteria';
> 
> The sql should then give you a list of keys.
> You can then set the layer filter like this:
> "ID" IN (...comma seperated key list...)
> ea: "ID" IN ('1','A')
> 
> Regards, Kenneth Skovhede, GEOGRAF A/S
> 
> 
 i really stucked! really dont have an idea to change Filter element in
xml.what i want to know here is how to pass a value that i get from sql
query(php) to xml?i have create a php script, a very simple one to query
data from database.

$wr_selected="SELECT * FROM wr WHERE bl_id = 'Rev";

$rs=odbc_exec($conn,$wr_selected);


while(odbc_fetch_row($rs))
{
$bl_id=odbc_result($rs,"bl_id");
}

currently $bl_id hold a value that satisfy a query. So i want this value put
into the <Filter></Filter> element in xml file such as <Filter>BL_ID IN
$bl_id</Filter> but i know this is something we cannot do.
I look at this code from

  
$QueryFilter='Drawing+%3D+%26apos%3B74%26apos%3B+AND+Dept+%3D+%26apos%3B136%26apos%3B' 
   // Load the Query Match Layer Definition template into a PHP DOM object
and 
   // modify its Filter node so we're displaying the right building and
floor. 
   $doc = DOMDocument::load('QueryMatch.LayerDefinition.xml'); 
   $FilterNode = $doc->getElementsByTagName('Filter')->item(0); 
   $FilterNode->nodeValue = $QueryFilter; 
   $LayerDefinition = $doc->saveXML(); 
   $byteSource = new MgByteSource($LayerDefinition,   
strlen($LayerDefinition)); 
   $byteSource->SetMimeType(MgMimeType::Xml); 
   $tempResourceID = new
MgResourceIdentifier("Library://HumboldtFM/Layers/QueryMatch.LayerDefinition"); 
   $resourceService->SetResource($tempResourceID, $byteSource->GetReader(),
null); 

but i really dont know that to do with this code. Can someone here assist
me?
-- 
View this message in context: http://n2.nabble.com/invalid-XML-document-tp2149327p2155085.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list