[mapguide-users] RE: Come get your Key IDs

Kori Maleski km at pat.ca
Thu Jun 29 14:27:42 EDT 2006

I forgot to follow up on your last comment:
It would be perfect if you had a parameter passing specification in the Layer Configuration of Studio that operated just like the Tool Tip or the Filter.
i.e.  you could specify a single column and/or a concatenation or operation deriving from.
That way you could hardcode each layer to pass specifically what you want within the selection set.
Your server-side code could parse the id however you specify.  I think non-programming types would be able to handle this better.
Kori Maleski  BSc. 
Senior Technical Consultant
Pacific Alliance Technologies
Suite 400 - 534 17 Ave. SW Calgary, AB CANADA T2S 0B1
TEL 403.770.1917 FAX 877.691.9149 TOL 877.691.9171 www.pat.ca <http://www.pat.ca/> 


From: Andy Morsell [mailto:amorsell at spatialgis.com]
Sent: Thu 29/06/2006 11:33 AM
To: users at mapguide.osgeo.org
Subject: [BULK] RE: [mapguide-users] RE: Come get your Key IDs

I don't think you have to know the column order.  In my case I am getting to it directly by field name.  I am creating the filter, query options and feature reader the same way, though.  Also, my MgPropertyType is hardcoded here.  Your way of determining it from the field is better.
Here is part of the C# code for it:
//loop through the featureReader, get the ID field, and add it to an array   
ArrayList objDBID = new ArrayList(0);
while (featureReader.ReadNext())
        objDBID.Add(featureReader.GetString("ID")); //TO DO: un-hard code this.  Pick up the field name to be queried from a request parameter instead.
My biggest problem with these solutions is that the non-programmer types are not going to be able to easily do this.  We really need a way to easily pass ANY field in a given layer from a selection set client-side.


From: Kori Maleski [mailto:km at pat.ca] 
Sent: Thursday, June 29, 2006 10:15 AM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] RE: Come get your Key IDs


The Selection Set contains the featureIDs for your datasource.
You can get YOUR key IDs from the Selection set by querying the feature, then reading your preferred key Column (property).

You have to know your key columns position in order to do this - hence my variable - l_iKeyColumnOrdinal.
i.e. - if my key IDs are in column 4 then  l_iKeyColumnOrdinal = 4
I utilize a lookup table that manages my key columns.  Not sure if this is the best way but it works.

This returns MY key IDs in a column delimited string.


'query the features

Dim l_oQuery As New MgFeatureQueryOptions()
l_oQuery.SetFilter(l_sFilter) 'derived from selection set


Dim l_ofeatureSource As MgResourceIdentifier = New MgResourceIdentifier(l_oSelLayer.GetFeatureSourceId())
Dim l_ofeatures As MgFeatureReader = l_oFeatureSrvc.SelectFeatures(l_ofeatureSource, l_sFeatureClassName, l_oQuery)


If l_ofeatures.ReadNext() Then
Dim l_sProperty As String = l_ofeatures.GetPropertyName(l_iKeyColumnOrdinal)


Dim pi As Integer
'For pi = 0 To l_ofeatures.GetPropertyCount() - 1

Dim l_iPropType As Integer = l_ofeatures.GetPropertyType(l_sProperty)
Dim l_sPropertyValue As String = ""

Select Case l_iPropType
Case MgPropertyType.Boolean
l_sPropertyValue = l_ofeatures.GetBoolean(l_sProperty).ToString()
Case MgPropertyType.Single
l_sPropertyValue = l_ofeatures.GetSingle(l_sProperty).ToString()
Case MgPropertyType.Double
l_sPropertyValue = l_ofeatures.GetDouble(l_sProperty).ToString()
Case MgPropertyType.Int16
l_sPropertyValue = l_ofeatures.GetInt16(l_sProperty).ToString()
Case MgPropertyType.Int32
l_sPropertyValue = l_ofeatures.GetInt32(l_sProperty).ToString()
Case MgPropertyType.Int64
l_sPropertyValue = l_ofeatures.GetInt64(l_sProperty).ToString()
Case MgPropertyType.String
l_sPropertyValue = l_ofeatures.GetString(l_sProperty)
End Select

If l_sSelectedLayerIDs = "" Then
l_sSelectedLayerIDs = l_sPropertyValue
l_sSelectedLayerIDs = l_sSelectedLayerIDs + "," + l_sPropertyValue
End If

'Next pi

Loop While l_ofeatures.ReadNext()

Obviously you have to do this server side...
Kori Maleski  BSc. 
Senior Technical Consultant
Pacific Alliance Technologies
Suite 400 - 534 17 Ave. SW Calgary, AB CANADA T2S 0B1
TEL 403.770.1917 FAX 877.691.9149 TOL 877.691.9171 www.pat.ca <http://www.pat.ca/> 


From: Andrew DeMerchant [mailto:andrew.demerchant at gemtec.ca]
Sent: Thu 29/06/2006 10:32 AM
To: users at mapguide.osgeo.org
Subject: Re: [mapguide-users] Andy - Question about your tooltips...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 14211 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060629/559748dd/attachment.bin

More information about the Mapguide-users mailing list