Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Looping, Setting and Updating! Oh My.

$
0
0

Hello all, I am very new to CF and our regular guy is on vaction so I could really use some help. I am getting geo location from Bing for multiple address that I have in a db. Then add the latitude and longitude to the latitude field and longitude field in the respective row I am able to run the function(s) indivulally but I need help looping through each row. Here is what I have. I hope this makes sense!

 

 

 

<!---query the db--->

 

 

<cfquery datasource="square" name="ListingShort">

     

            SELECT

                                        MLS_Id,List_Price,Public_Address,Street_Number,Street_Name,Unit_Numbe r,City,Zip_Code,Subdivision_Name,Bedroom,Baths_Total,Full_Baths,Half_B aths,Square_Feet,Lot_Sqft,Garage_Capacity,Garage_Type,High_School,Juni or_School,Property_Description,Listing_Office_Name,Listing_Office_Id,L isting_Agent_Name,Listing_Agent_Phone,Listing_Agent_Id,Short_Sale,Open _House_Flag,Last_Image_Update,Price_Change_Date,Image_Count,Latitude,L ongitude

       

            FROM GLVAR_daily_bulk

   

                      WHERE MLS_Id=1375233

  

</cfquery>

 

 

<!---get the data back from Bing--->

 

 

<cfhttp url="http://dev.virtualearth.net/REST/v1/Locations/US/NV/#ListingShort.Zip_ Code#/#ListingShort.City#/#ListingShort.Street_Number#%20#ListingShort .Street_Name#?o=xml&key=AgM3wR0ojSpxYaJeh6WS7p2kcckECqVQ5HkrweFcZCcyOj E3mYVvIrF_WzbETMeb" timeout = "2" method="GET">

 

 

<cfset xbinglocation = xmlparse(cfhttp.filecontent)>

<cfset lat=xbinglocation.Response.ResourceSets.ResourceSet.Resources.Locatio n.Point.Latitude.XmlText>

<cfset long=xbinglocation.Response.ResourceSets.ResourceSet.Resources.Locati on.Point.Longitude.XmlText>

 

 

<!---update the latitude and longitude fields--->

 

 

<cfquery datasource="square" name="addGeo">

 

                              UPDATE glvar_daily_bulk

                              SET Latitude = #lat#,

               Longitude = #long#

               WHERE MLS_Id=1375233

           

</cfquery>


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>