May 8, 2008

Cannot Select Entities in Mapguide Enterprise 2009 Viewer

Filed under: Mapguide — Tags: , — Darrin Maidlow @ 3:27 am

I recently encountered a frustrating problem in my travels.  When the map in my application came up, I could not select any entities.  Both window and single selections just did nothing.  I had recently setup my so I was not sure if I had missed something in the configuration there.  In addition to this, my application is doing some dynamic authoring and adding a bunch of layers to the map before the viewer loads it up.

I saved a copy of the dynamically generated maps and layers to the library repository.  Everything checked out.  The layers were marked as selectable.

Next step was to check out the server logs on my Mapguide server.    We have a nice error occurring a lot: Error: An exception occurred in FDO component. String does not represent a valid filter.

So into the code I go.  I ripped out all my dynamic authoring calls, and the map loads and selects no problem.  As I was starting to suspect, my code was to blame – and there is something specific to my filters on the layers:

   1: newLayer.VectorLayerDefinition.Filter = "BLDG_ID = """ & szBldgID & """ AND BLDG_FLOOR "" IN(0," & nFloorNumber.ToString & ")"""


I had assumed that FDO had an IN clause, did a quick check in Mapguide Studio’s condition builder and didn’t see one.  Fair enough, in this case I can get by with two equals conditions in my select as the list of conditions will only ever consist of two values.

   1: newLayer.VectorLayerDefinition.Filter = "BLDG_ID = " & szBldgID & " AND (BLDG_FLOOR = 0 OR BLDG_FLOOR = " & nFloorNumber.ToString & ")"
   2: 'newLayer.VectorLayerDefinition.Filter = "BLDG_ID = " & szBldgID & " AND BLDG_FLOOR  IN(0," & nFloorNumber.ToString & ")"""

Long story short, if you are selecting items in the map viewer that are supposed to be selectable, check your server logs.

Technorati Tags: ,,

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

Switch to our mobile site