July 7, 2008

Mapguide Enterprise – Cannot Select Items in DWF and AJAX viewer – Again

Filed under: Mapguide — Tags: , , — Darrin Maidlow @ 10:41 pm

I had another problem with Mapguide Enterprise 2009 recently pertaining to objects not being selectable.  Unlike my previous post on errors caused by layers, no errors were logged to the Mapguide server logs.  This problem is very likely specific to the enterprise version, as I was using the Autodesk FDO Provider for Oracle.

So a data connection was created pointing to the Oracle 10g schema.  This database contained a number of tables containing Lat/Long point geometry entities.  I created a layer pointing to the table in question.  I created a layer pointing to that data connection.  At this point the entities showed up as expected in the both the DWF and the AJAX viewers.  Once again, I could not select any of the entities.  I checked the server logs, no errors were reported.

In troubleshoot mode, I tried just about everything I could think of but nothing would work.  I simplified the theme, created new layers, removed all other layers from them map.  Eventually I created a new layer from another table.  Luckily, the entities on this layer could be selected.  It must be a problem with the underlying data.  On a hunch, I checked the table definitions – specifically looking at primary keys.  The selectable layer had a primary key defined, the problem layer did not.  (Good thing I cannot take credit for creating this source data =))

So, I created a primary key on the problem table, did a touch on the layer definition (opening the definition in Studio and saving it without any changes) and then left for twenty minutes.  I’m thinking there is some sort of caching going within the server, and I’m not sure how it works.  Immediately reloading the map after adding the primary key did not work – the entities were still not selectable.  When I came back – the items in the viewers were now selectable.

So long story short, if again you cannot select map entities using the Autodesk FDO Provider for Oracle ensure that the source table has a primary key defined.  Hopefully this saves someone some grief =)

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: ,,

Powered by WordPress

Switch to our mobile site