6 Replies Latest reply on Aug 27, 2013 10:50 AM by CF_noobi_wan

    Looping, Setting and Updating! Oh My.

    CF_noobi_wan

      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_Number,City,Zip_Code,Subd ivision_Name,Bedroom,Baths_Total,Full_Baths,Half_Baths,Square_Feet,Lot_Sqft,Garage_Capacit y,Garage_Type,High_School,Junior_School,Property_Description,Listing_Office_Name,Listing_O ffice_Id,Listing_Agent_Name,Listing_Agent_Phone,Listing_Agent_Id,Short_Sale,Open_House_Fla g,Last_Image_Update,Price_Change_Date,Image_Count,Latitude,Longitude

             

                  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=AgM3wR0ojSpxYaJe h6WS7p2kcckECqVQ5HkrweFcZCcyOjE3mYVvIrF_WzbETMeb" timeout = "2" method="GET">

       

       

      <cfset xbinglocation = xmlparse(cfhttp.filecontent)>

      <cfset lat=xbinglocation.Response.ResourceSets.ResourceSet.Resources.Location.Point.Latitude.Xml Text>

      <cfset long=xbinglocation.Response.ResourceSets.ResourceSet.Resources.Location.Point.Longitude.X mlText>

       

       

      <!---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>