Pregunta

Really confused here.

I am parsing an XML geocode from Bing - and I seem to be getting the variable just fine. However, when I use that variable in my Query - I don't get the value of the variable - but the entire XML string?!

<cfset variables.BingXML = xmlparse(cfhttp.filecontent)> 

<cfset variable.Bing.Lat = "#variables.BingXML.Response.ResourceSets.ResourceSet.Resources.Location.Point.Latitude#">
<cfset variable.Bing.Lon = "#variables.BingXML.Response.ResourceSets.ResourceSet.Resources.Location.Point.Longitude#">
<cfoutput>
#variable.Bing.Lat# 
#variable.Bing.Lon#
</cfoutput>

This returns the RIGHT Numbers:

38.4935302734375
-101.35395050048828 

But in the cfquery I get:

SELECT NATSS_Locations.*, NATSS_PaymentTypes.PTName, NATSS_PaymentTypes.PTImage, NATSS_PaymentTypeLinks.NPTLID,
   NATSS_NationalAccounts.NNAImage,  NATSS_NationalAccounts.NNAName, NATSS_LocNationalAcctLink.NLNALID,
   ((3963.191 * ACOS((SIN(PI() * '#variable.Bing.Lat#' / 180) * SIN(PI() * NATSS_Locations.LocationLat / 180)) + (COS(PI() * #variable.Bing.Lat# /180) * cos(PI() * NATSS_Locations.LocationLat / 180) * COS(PI() * NATSS_Locations.LocationLong / 180 - PI() * #variable.Bing.Lon# / 180)) )) * 1) as Distance 

Becomes:

SELECT NATSS_Locations.*, NATSS_PaymentTypes.PTName, NATSS_PaymentTypes.PTImage, NATSS_PaymentTypeLinks.NPTLID, 
    NATSS_NationalAccounts.NNAImage, NATSS_NationalAccounts.NNAName, NATSS_LocNationalAcctLink.NLNALID,
   ((3963.191 * ACOS((SIN(PI()     * '<?xml version="1.0" encoding="UTF-8"?><Latitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">38.4935302734375</Latitude>' / 180) * SIN(PI() * NATSS_Locations.LocationLat / 180)) + (COS(PI() * <?xml version="1.0" encoding="UTF-8"?><Latitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">38.4935302734375</Latitude> /180) * cos(PI() * NATSS_Locations.LocationLat / 180) * COS(PI() * NATSS_Locations.LocationLong / 180 - PI() * <?xml version="1.0" encoding="UTF-8"?><Longitude xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">-101.35395050048828</Longitude> / 180)) )) * 1) as Distance

Anyone have a solution or idea on this?

¿Fue útil?

Solución

On

<cfset variable.Bing.Lat            
  = "#variables.BingXML.Response ... Point.Latitude#">
<cfset variable.Bing.Lon           
  = "#variables.BingXML.Response ... Point.Longitude#">

You should have something like:

 <cfset variable.Bing.Lat            
   = variables.BingXML.Response ... Point.Latitude.xmlText>
 <cfset variable.Bing.Lon            
   = variables.BingXML.Response ... Point.Longitude.xmlText>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top