Alpha Video Training
Results 1 to 6 of 6

Thread: 7 Day Weather Forcast

  1. #1

    Default 7 Day Weather Forcast

    Just threw this function together, it only returns pointers. I would like to attach a GUI to it, but I'm not the greatest at those. Any suggestions/code for a GUI would be useful.

    James

    The return format is:
    Code:
    c=weather_7day("21921")
    ?c
    = AllocationFactor = "0.006463"
    +Day.
    FipsCode = "24"
    Latitude = "39.6264343"
    Longitude = "75.84584"
    PlaceName = "ELKTON"
    StateCode = "MD"
    ?c.Day
    = +A.
    +B.
    +C.
    +D.
    +E.
    +F.
    +G.
    
    ?c.Day.A
    = MaxtemperatureC = "4"
    MaxTemperatureF = "40"
    MintemperatureC = "3"
    MinTemperatureF = "37"
    Name = "Wednesday, January 30, 2008"
    
    ...
    
    ?c.Day.G
    = MaxtemperatureC = "11"
    MaxTemperatureF = "51"
    MintemperatureC = "1"
    MinTemperatureF = "34"
    Name = "Tuesday, February 05, 2008"
    WeatherImage = "http://forecast.weather.gov/images/wtf/shra40.jpg"
    The code for the function is:
    Code:
    'Date Created: 29-Jan-2008 05:48:54 PM
    'Last Updated: 30-Jan-2008 12:05:38 AM
    'Created By  : Mr. GreenJeans
    'Updated By  : Mr. GreenJeans
    FUNCTION weather_7day AS A (zip_code AS C)
        if zip_code =null_value() then
            end 
        end if
        dim p as P
        dim i as N
        dim f as C
        dim Forcast as P
        Dim Forcast.Day as P
        Dim Day as P
        Dim Day.A as P
        Dim Day.B as P
        Dim Day.C as P
        Dim Day.D as P
        Dim Day.E as P
        Dim Day.F as P
        Dim Day.G as P
        url = "www.webservicex.net/WeatherForecast.asmx/GetWeatherByZipCode"
        body = "ZipCode="+zip_code
        p = http_post(url,body)
        f = p.body
        Forcast.Latitude = extract_string(f,"<Latitude>","</Latitude>",1)
          Forcast.Longitude= extract_string(f,"<Longitude>","</Longitude>",1)
          Forcast.AllocationFactor = extract_string(f,"<AllocationFactor>","</AllocationFactor>",1)
          Forcast.FipsCode = extract_string(f,"<FipsCode>","</FipsCode>",1)
          Forcast.PlaceName = extract_string(f,"<PlaceName>","</PlaceName>",1)
          Forcast.StateCode = extract_string(f,"<StateCode>","</StateCode>",1)
        
        
        Day.A.Name = extract_string(f,"<Day>","</Day>",1)
        'Day.A.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",2)
        Day.A.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",1)
        Day.A.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",1)
        Day.A.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",1)
        Day.A.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",1)
        Day.B.Name = extract_string(f,"<Day>","</Day>",2)
        Day.B.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",2)
        Day.B.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",2)
        Day.B.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",2)
        Day.B.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",2)
        Day.B.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",2)
        Day.C.Name = extract_string(f,"<Day>","</Day>",3)
        Day.C.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",3)
        Day.C.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",3)
        Day.C.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",3)
        Day.C.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",3)
        Day.C.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",3)
        Day.D.Name = extract_string(f,"<Day>","</Day>",4)
        Day.D.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",4)
        Day.D.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",4)
        Day.D.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",4)
        Day.D.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",4)
        Day.D.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",4)
        Day.E.Name = extract_string(f,"<Day>","</Day>",5)
        Day.E.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",5)
        Day.E.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",5)
        Day.E.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",5)
        Day.E.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",5)
        Day.E.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",5)
        Day.F.Name = extract_string(f,"<Day>","</Day>",6)
        Day.F.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",6)
        Day.F.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",6)
        Day.F.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",6)
        Day.F.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",6)
        Day.F.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",6)
        Day.G.Name = extract_string(f,"<Day>","</Day>",7)
        Day.G.WeatherImage     = extract_string(f,"<WeatherImage>","</WeatherImage>",7)
        Day.G.MaxTemperatureF = extract_string(f,"<MaxTemperatureF>","</MaxTemperatureF>",7)
        Day.G.MinTemperatureF = extract_string(f,"<MinTemperatureF>","</MinTemperatureF>",7)
        Day.G.MaxtemperatureC = extract_string(f,"<MaxTemperatureC>","</MaxTemperatureC>",7)
        Day.G.MintemperatureC = extract_string(f,"<MinTemperatureC>","</MinTemperatureC>",7)
        
        forcast.day = day
        
    
        weather_7day = Forcast
    END FUNCTION

  2. #2
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,644

    Default Re: 7 Day Weather Forcast

    If the question is where do you want to put the data? Then there are several possibilities: Memo field, variable, static text object (to view on a form), report (-->PDF), possibly more. So it may come down to - what do you want to see and where do you want to see it?

  3. #3

    Default Re: 7 Day Weather Forcast

    Yes i agree, There are several possibilities. This is why I decided to leave the output as a Pointer. This way it could be used for any application. Inserting it as a text or Xdialouge would be possible....but at the same time on a daily report would be just as easy.

    James

  4. #4
    Member
    Real Name
    Dragan Milosavljevic
    Join Date
    Mar 2010
    Location
    Belgrade, Serbia
    Posts
    79

    Default Re: 7 Day Weather Forcast

    HI Mr GreenJeans ,

    I found today this function.Yes it's 10 years old. But I like to try it.
    And , it does't work. Probably because of some changes on "WeatherForecast" site.
    Do you know how to meke it work today.

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: 7 Day Weather Forcast

    The url

    "www.webservicex.net/WeatherForecast.asmx/GetWeatherByZipCode"

    returns 404 not found so it is unlikely to be "fixable".
    There can be only one.

  6. #6
    VAR
    Real Name
    Mike Reed
    Join Date
    Apr 2000
    Location
    Phoenix, AZ
    Posts
    668

    Default Re: 7 Day Weather Forcast

    I haven't tried this yet, but check out this site. Looks like it might be easy code to add.

    https://www.findlocalweather.com/fre...r_website.html
    Mike Reed
    Phoenix, AZ

Similar Threads

  1. How can i pull weather sunrise sunset times
    By Digitaled in forum Alpha Five Version 7
    Replies: 0
    Last Post: 02-07-2007, 04:59 AM
  2. Any Alpha Weather Database Ideas/Examples?
    By SWWeatherGuy in forum Alpha Five Version 7
    Replies: 7
    Last Post: 08-22-2006, 03:08 PM
  3. Weather Database Design Advice?
    By SWWeatherGuy in forum Database Design
    Replies: 1
    Last Post: 07-25-2006, 09:39 PM
  4. Calendar Day View - Day Wrong
    By scottly in forum Alpha Five Version 5
    Replies: 4
    Last Post: 04-05-2004, 03:18 PM
  5. Day Field
    By Al Cole in forum Alpha Five Version 4
    Replies: 2
    Last Post: 08-08-2000, 12:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •