Hexagon Geospatial
MENU

GeoMedia Smart Client

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Staff
Posts: 38
Registered: ‎02-27-2018

No highlight on object after using IG.setSelectedElements()

[ Edited ]

Using GMSC 2016.03.

 

I have a list with an action for every row that sets the feature active in GMSC, sets the element as selected and zoom to it on the map.

list.png

 

For all my other layer, the action work perfectly fine with the following code:

action="SCRIPT[IG.setActiveFeature('<layername>');IG.setSelectedElements({ROW.<idfield_name>});IG.fitSelectedElements();IG.bringToFront();IG.setMapScale(250)]"

However for two layers it does not work quite properly:

  • the layer is set on active
  • the object is zoom to (scale ist right - it seems to zoom to the right feature...most of the time [edit: seems to be mostly the wrong feature])
  • BUT the object itself is not highlighted as "selected"

 

The only things that differs here is the fact that both layers havethe same database table as source but with a different attribute-based filter: there are two types of object in the table and the client decided to register them as 2 separate features instead of using a filter at the symbology level.

 

I am wondering if there might be some interference between the two.

 

Has anyone had a similar experience?

or is there something else I could check/change to pinpoint the problem?

 

Cheers,

 

PS: log file was not helpful...

 

Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: No highlight on object after using IG.setSelectedElements()

[ Edited ]

the JS API has changed, it is asynchronous, with your action specification there is no guarantee the methods are executed in that order. Please check the following tutorial:

 

https://community.hexagongeospatial.com/t5/GMSC-Tutorials/Javascript-API/ta-p/25119

 

 

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Staff
Posts: 38
Registered: ‎02-27-2018

Re: No highlight on object after using IG.setSelectedElements()

Is this change of API relevant for GMSC 2016.03?

 

Staff
Posts: 38
Registered: ‎02-27-2018

Re: No highlight on object after using IG.setSelectedElements()

I tried your solution with GMSC 2016.03 and I cannot bring it to work.

I tried with the IG. and the SC. version.

As mentioned earlier my code works fine for 10 other features.

 

What I noticed is that the ID of the object saved in the SEC_SESSION behaves strangely.

Sometimes it is saved as an integer and sometimes .0 is added to the ID (see image), sometimes it is saved with the name of the schema (Oracle DB) and sometimes not. Might it be that there is a problem here?

 

The ID-column has the following datatype: NUMBER

 

Any ideas of what I could try next?

 

 

Staff
Posts: 1,036
Registered: ‎10-18-2015

Re: No highlight on object after using IG.setSelectedElements()

the schema is part of the session variable if it is set in the feature settings. No idea how that .0 is added to the pk value. Please try:

  • selecting an object on the map
  • opening a form 

you should get the value in the session in the proper way.

 

As said your way to define the action may even work in 99% of the cases, but there are no guarantee it will always work.

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 68
Registered: ‎11-12-2015

Re: No highlight on object after using IG.setSelectedElements()

Hi,

 

I had similar problem. Elements selected by javascript were not highlighted when primary key in database had FLOAT type in DB or type NUMBER without range specification (I am using Oracle) -> when I changed the datatype in DB to NUMBER(9), everything works as expected.

 

Tereza

Highlighted
Staff
Posts: 38
Registered: ‎02-27-2018

Re: No highlight on object after using IG.setSelectedElements()

[ Edited ]

Hi Tereza,

that is indeed my next step: change the datatype in Oracle from NUMBER to NUMBER(18,0) for the PK-field. I will come back and confirm if this works for me as well.

 

[UPDATE]  Changing the datatype as mentionned above solved the problem

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.