Weather Forecast

Sometimes it can be useful to know the weather forecast for a specific location. For example, outdoor installation tasks need to scheduled when the weather is suitable. This technique pulls weather forecast information provided by the Bureau of Meteorology (BOM) for locations throughout Australia.

Last updated 27 May 2019.



Time to implement: 1 hour
Skill level:
Region: Australia

Decide which table you’ll be displaying weather information for. These record should contain location data (town/suburb and state) and a date (as weather forecasts are date specific). In our demo the table is called Job.

If you don’t already have Date, Suburb and State fields in your selected table, create them.

Next copy the 8 Job Weather_ fields into your table; 2 text fields, 2 number fields, 2 calculation fields, a container and a timestamp.

Copy the script Update Weather [Single] and paste it into your database. If you temporarily rename your source table to Job and the field names are the same then the copied script won’t contain any errors. Otherwise, you’ll need to check the script for missing references to the Weather_ and Date fields.

The script will check to ensure the current record has a location (suburb and state) and a valid date. The BOM only provide forecast data for the next 6 days. The script downloads data for the relevant location using the BOM website – see comments in the script for an explanation of how this works.

Add the fields Weather_InfoReturned and Weather_Image_o to any layout you’ll be running the Update Weather [Single] script on. They are needed for the Insert From URL script step to work.



Add the Weather_Forecast_c and Weather_Image_o fields to any layouts where you’d like to show the weather for the record being viewed. A tooltip can be used to display when the weather was last updated.

Attach the script Update Weather [Single] to a button and run this script. If the suburb and state match an entry on the BOM website and the date entered falls in the next 6 days the script should return the weather forecast, including an image.


If you would like to update the weather of all records in the found set use the script Update Weather [List]. Don’t forget to include the fields Weather_InfoReturned and Weather_Image_o on your list layout.



STEP 10:
The script Update Weather [Single] has a hidden feature. When the Control key is held down and the script is run the location entry from the BOM website will be displayed in your default web browser. Developer can use this to verify the script has worked correctly. Users can use is to see a detailed forecast for the upcoming week.


Possible extensions to this technique

The update script run on server to automatically download the weather forecast at regular intervals, displaying the 7 day forecast for all records.

Last updated 27 May 2019