After some testing here it looks like a bug with the ODBC provider in general. 
I think there may be 2 defects here.

1) I'm getting a server error about the geometry property not being found when 
previewing the geometry.
2) I'm seeing the null computed values like you are when previewing the data.

It looks like this won't work with and ODBC source.

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Friday, March 27, 2009 1:32 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Hi Dave,
  in this morning I have add a computed property (I have used this expression: 
"Concat (  'Nome Sito: '  ,  Concat (  NOME_SITO ,  Concat ( '\nCodice Sito: ' 
, Concat (  SITENUMBER ,  Concat (  '\nSrambling Code: ' ,  SCRAMBLING_CODE  )  
 )     )   )   )" ) from Studio . I have edit my layer to point at the new 
extended feature class. However when I open my weblayout  I don't see the 
feature objects. If I go on FeatureSource Preview of Studio and select the the 
view data voice of extended feature class I see that the value of computed 
property the I add is void.
Is a SQLServer ODBC Bug?
Regards
Matteo



Are you using the ODBC provider then for the connection since you pointed out 
the Lat/Lon fields?

It may be a bug with the ODBC provider. I understand your need to code it, 
however I was wondering if you tested it with Studio also. If that fails too 
it's likely a general bug.

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Thursday, March 26, 2009 2:50 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Dave, my featuresource is a MSSQL 2005 table with LAT, LON fields
Add a computed property via Studio is not a good solution for my case because I 
manage 10 projects with a total of 100 featuresource of this type and this 
function will work for all of those
Thanks a lot
Matteo


What is the data format of the feature source SDF, SHP? It may be a bug.

What if you make a copy of the existing feature source and add the computed 
property via Studio does that work?

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Thursday, March 26, 2009 1:33 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Hi Dave,
  if I change this code

 Dim strTooltipValue as string=GetValueFromReader(objFeatureReader, 
objFeatureReader.GetPropertyType("thetooltip"), "thetooltip")

with this one

Dim strTooltipValue as string=GetValueFromReader(objFeatureReader, 
objFeatureReader.GetPropertyType("ID"), "ID")

where ID is a property of featuresource I haven't any error so I think that the 
problem is the computed property.

Matteo


I would do the following to better debug things.

You should check that the objFeatureReader returned from the SelectFeatures 
call is not null before starting the .ReadNext.

As well note that you don't appear to have set the filter either so you will 
likely get more than 1 record back from your data.

You might also try the SelectFeatures without adding the computed property, but 
instead specify an existing known property and include the filter.

This looks like it should work.

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Thursday, March 26, 2009 11:13 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Hi Dave,
 this is my code:

Dim objQueryOptions As MgFeatureQueryOptions = New MgFeatureQueryOptions()
Dim strTooltipExpression as string= ="Concat (  'Nome Sito: '  ,  Concat (  
NOME_SITO ,  Concat ( '\nCodice Sito: ' , Concat (  SITENUMBER ,  Concat (  
'\nSrambling Code: ' ,  SCRAMBLING_CODE  )   )     )   )   )"
objQueryOptions.AddComputedProperty("thetooltip", strTooltipExpression )


Dim objFeatureReader As MgFeatureReader
objFeatureReader = objFeatureServ.SelectFeatures(New 
MgResourceIdentifier(objLayer.GetFeatureSourceId), 
objLayer.GetFeatureClassName, objQueryOptions)
While objFeatureReader.ReadNext()
  Dim strTooltipValue as string=GetValueFromReader(objFeatureReader, 
objFeatureReader.GetPropertyType("thetooltip"), "thetooltip") ' I get the error 
on this line of code
End While

GetValueFromReader function is a my function that return the property value. 
This is the function code:
 Function GetValueFromReader(ByVal objFeatureReader As MgReader, ByVal 
intpropertyType As Integer, ByVal strpropertyName As String) As String
        Dim isNull As Boolean = objFeatureReader.IsNull(strpropertyName)

        If intpropertyType = MgPropertyType.Boolean Then
            If isNull Then
                Return "null"
            Else
                Return objFeatureReader.GetBoolean(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Byte Then

            If isNull Then
                Return "null"
            Else
                Return objFeatureReader.GetByte(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Clob Then
            If isNull Then
                Return "null"
            Else
                Return "notNull"
            End If

        ElseIf intpropertyType = MgPropertyType.DateTime Then
            Dim dateTimeStr As String = Nothing
            If isNull Then
                Return "null"
            Else
                Dim aDateTime As MgDateTime = 
objFeatureReader.GetDateTime(strpropertyName)
                dateTimeStr = aDateTime.Month.ToString() + "."c + 
aDateTime.Day.ToString() + "."c + aDateTime.Year.ToString() + ":"c + 
aDateTime.Hour.ToString() + ":"c + aDateTime.Minute.ToString() + ":"c + 
aDateTime.Second.ToString()
                Return dateTimeStr
            End If

        ElseIf intpropertyType = MgPropertyType.Double Then
            If isNull Then
                Return "0"
            Else
                Return objFeatureReader.GetDouble(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Feature Then
            If isNull Then
                Return "null"
            Else
                Return "notNull"
            End If
        ElseIf intpropertyType = MgPropertyType.Int16 Then
            If isNull Then
                Return "0"
            Else
                Return objFeatureReader.GetInt16(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Int32 Then
            If isNull Then
                Return "0"
            Else
                Return objFeatureReader.GetInt32(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Int64 Then
            If isNull Then
                Return "0"
            Else
                Return objFeatureReader.GetInt64(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.Raster Then
            If isNull Then
                Return "null"
            Else
                Return "notNull"
            End If

        ElseIf intpropertyType = MgPropertyType.Single Then
            If isNull Then
                Return "null"
            Else
                Return objFeatureReader.GetSingle(strpropertyName).ToString()
            End If

        ElseIf intpropertyType = MgPropertyType.String Then
            If isNull Then
                Return "null"
            Else
                Return objFeatureReader.GetString(strpropertyName)
            End If

        Else
            Return ""
        End If
    End Function

Regards,
Matteo


Can you show a larger block of code? It seems like something else is wrong 
after you add the computed property to the QueryFeatureOptions object.

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Thursday, March 26, 2009 6:19 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Hi Dave,
  the Response.Write("Computed Property index: " + result.ToString()); 
expression return to me "1". So I think that 1 property is add but when I try 
to get the property values MG give me this error 
"OSGeo.MapGuide.MgObjectNotFoundException: The specified object was not found".

I call my property with this name "thetooltip" and the property expression is: 
Concat (  'Nome Sito: '  ,  Concat (  NOME_SITO ,  Concat ( '\nCodice Sito: ' , 
Concat (  SITENUMBER ,  Concat (  '\nSrambling Code: ' ,  SCRAMBLING_CODE  )   
)     )   )   )

I can't modify the featuresource because is used from another program

Regards,
Matteo


So I'm guessing in your code you have something like:

result=mgFeatQueryOptions.AddComputedProperty(computedPropAlias, computedProp);
So what if you add a debug statement after it to do something like echo the 
following:

Response.Write("Computed Property index: " + result.ToString());

An alternative to trying to do this in code might be to edit the feature source 
and add the computed property there. Create your layer using the extended 
feature class and in your code you can just select this property without having 
to do the computed property bit, but if there is something wrong with the 
expression you have maybe that is causing the computed property to actually get 
added. I wouldn't call it tooltip by the way as that seems too much like a 
keyword. I would call it theToolTip or something to be safe.

Dave
-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Wednesday, March 25, 2009 10:57 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Tooltip value from object


Hi Dave,
  now I get the tooltip expression from Layer definition and I add a computed 
property on MgFeatureQueryOptions. I have used "tooltip" alias. However when I 
try to read the tooltip property mapguide not find it on property collection.
Can you help me?
Regards,
Matteo


Can you parse the layer definition to get the expression and execute a query 
using the expression as the select statement with the addition of a feature id 
or key value?

Dave

-----Original Message-----
From: mapguide-users-boun...@lists.osgeo.org 
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Matteo
Sent: Tuesday, March 24, 2009 11:39 AM
To: mapguide-users@lists.osgeo.org
Subject: [mapguide-users] Tooltip value from object


Hi All,
  I need to get the tooltip value from a single object of a layer. In the layer 
definition the tooltip is an expression. I develop with MG 2.0.2 and ASP.NET
Have any ideas?
Regards,
Matteo
--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2528017.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2533619.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2538007.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2539760.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2540610.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2541011.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



--
View this message in context: 
http://n2.nabble.com/Tooltip-value-from-object-tp2528017p2542913.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to