[mapguide-users] PHP script for getting data from selected item(s)

Andrew DeMerchant andrew.demerchant at gemtec.ca
Fri Jun 30 17:59:23 EDT 2006


Good suggestion for sure Andy. I had made my script somewhat tailored to 
my specific needs, while leaving it at least flexible enough to be used 
by other people to some extent....that'd be a good addition, but I'll 
leave it to who ever uses the code next.

Andrew

Andy Morsell wrote:
> That's awesome.  Thanks for supplying to the group.  One thing to 
> note, however, is the MgPropertyType for whatever the KeyName field 
> corresponds to.  In your case, it is a string, so you are using 
> $featureReader->GetString($KeyName).  It won't be a string in all 
> cases, so you may want to add a function to determine that dynamically 
> along the lines of what Kori had in his code yesterday:
>  
>
> 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
>
>  
>
> Andy
>
> ------------------------------------------------------------------------
> *From:* Andrew DeMerchant [mailto:andrew.demerchant at gemtec.ca]
> *Sent:* Friday, June 30, 2006 12:41 PM
> *To:* users at mapguide.osgeo.org
> *Subject:* [mapguide-users] PHP script for getting data from selected 
> item(s)
>
> Ok, I'm done my script....I'm using this script in an InvokeURL 
> button. Copy this php script into your MGSE www folder, then set it as 
> the URL to invoke. It needs 6 variables passed to it from InvokeURL; 
> 1) Key (this is $CurrentSelection), 2) DesiredField (this is the name 
> of the field that you'd like to get data for), 3) LayerName (kind of 
> stupid, but it's the name of the layer that you want to get the dat 
> from), 4) URL (the url that you want the php to forward to, 5) 
> DestinationKeyName (this is the name of the field that you're getting 
> data for...in case you'd like to use a different name than the one 
> that's on your database, 6) Additional (this can hold any other 
> parameters that you'd like to send...these just get passed straight 
> through to URL - avoid using quotes here, because Studio doesn't seems 
> to like that). There you have it. It suits my needs perfectly. Hope 
> it's useful to someone else out there!
>
> Andrew
> -- 
> 	*Andrew DeMerchant*
> *Computer Technologist*
> ph.1-877-4GEMTEC x.163
> fax 506-453-9470
>
> /GEMTEC Limited <http://www.gemtec.ca>
> /191 Doak Road
> Fredericton, NB, Canada
> E3C 2E6
>





More information about the Mapguide_users mailing list