[mapguide-users] Brain freeze Combining
MgFeatureQueryOptions.SetFilter For filtering and
MgFeatureQueryOptions.
Flipper
scotth at mpowerinnovations.com
Fri Dec 26 11:35:22 EST 2008
SOLVED IT MYSELF:
Here it is for those searching for it Granted it is in Coldfusion on Java
code...but should be decipherable
<cfif MgSelection.Contains(layer, featurename)>
<cfset MgFeatureQueryOptions.AddFeatureProperty(javacast("string",
"#Fieldname#"))>
<cfset MgFeatureQueryOptions.SetFilter(javacast("string",
"#SQLFilter#"))>
<cfset featureReader = featureSrvc.SelectFeatures(resourceIdentifier,
featurename, MgFeatureQueryOptions)>
<cfloop condition = "#featureReader.ReadNext()#">
<cfset PropertyType=
featureReader.GetPropertyType(Javacast("string", "#Fieldname#"))>
<cfswitch expression="#PropertyType#">
<cfcase value="1"><cfset DataType="GetBoolean"></cfcase>
<cfcase value="2"><cfset DataType="GetByte"></cfcase>
<cfcase value="4"><cfset DataType="GetSingle"></cfcase>
<cfcase value="6"><cfset DataType="GetInt16"></cfcase>
<cfcase value="7"><cfset DataType="GetInt32"></cfcase>
<cfcase value="8"><cfset DataType="GetInt64"></cfcase>
<cfcase value="9"><cfset DataType="GetString"></cfcase>
<cfcase value="10"><cfset DataType="GetBLOB"></cfcase>
<cfcase value="11"><cfset DataType="GetCLOB"></cfcase>
<cfcase value="12"><cfset DataType="GetFeature"></cfcase>
<cfcase value="13"><cfset DataType="GetGeometry"></cfcase>
<cfcase value="14"><cfset DataType="GetRaster"></cfcase>
<cfcase value="0"><cfset DataType="IsNull"></cfcase>
<cfdefaultcase><cfset DataType="GetString"></cfdefaultcase>
</cfswitch>
<cfset MySelKeys = MySelKeys &
Evaluate("featureReader.#DataType#('#Fieldname#')") & ",">
Flipper wrote:
>
> OK Here goes the scenario….
>
> i have a map that already has a selction made in it that contains objects
> on multiple layers… Pipes, CLs, and WaterNodes (points themed BY a field
> of ObjectType MH, Valve etc.)
>
> I need mapguide to return a list of values from the "NODEIDS" field for
> only selected items on the “WaterNodes” Layer Where the field "ObjectType"
> = ‘MH’.
>
> Ive gotten this to work by going crazy iterating through the feature
> reader and a layerFilter….But this is really inefficient and I know it
> isnt this difficult…
> I’m plain out missing something when trying to incorporate
> MgFeatureQueryOptions.SetFilter For filtering and
> MgFeatureQueryOptions.AddFeatureProperty for Limiting the properties
> returned?
> It seems I should be able to use these two functionalities to make this
> code much more streamlined without having to iterate a feature reader to
> loop through each object in the layer and then loop through each field on
> the object….Seems like I should be able to do this with no loops and no
> feature reader going through every object but I keep getting stonewalled I
> know Im just having a Mental block…Any takers willing to push me past this
> Brain Freeze?
>
>
--
View this message in context: http://n2.nabble.com/Brain-freeze-Combining-MgFeatureQueryOptions.SetFilter-For-filtering-and-MgFeatureQueryOptions.-tp1819271p1911261.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list