Module 1 - What Is A Variable?
In very broad terms, a variable is something that does not have a fixed value. Its value is variable from one moment to another. The interest rate on your mortgage, for example, is a variable; it changes during the term of your mortgage.
In broad programming terms, a variable is a location in memory that can hold any value it wants; it starts by being given an initial value, and later in the program it can get a new value. When you want to use that value, you make a reference to the variable by its name, and you are given whatever contents it currently has. This is extremely useful, since a variable can increase each time round a loop and allow you to pick out different records in a set; or it can be used to get information from the user of the program - information the program could never guess - and use it to alter how it behaves later.
In specific Public Talks Schedule scripting terms, a variable is a location in the scripting engine's memory that holds a piece of information that you, the person generating the script, give it. In this particular case it never changes value until you generate a new script; but the very fact that the information comes from you and can be anything you want, makes it a variable.
So what does a variable look like? Well, in PTS scripting we always use a dollar sign ($) to indicate a variable. It is any word you like with the dollar sign in front. Thus, $MyName, $SpeakerName and $Chairman are all valid variable names.
Note that, unlike in real programming, a variable name with an underscore in it is not acceptable, and won't work. Thus, $speaker_name is invalid. When you insert the variable request, it will not be seen as an error, but the parser will not understand when you try and reference it. Thus, a variable name in PTS must always consist of letters only - if you mix lowercase and uppercase that's fine, as long as you use the exact same combination both when you request the variable and when you try and use it. You might find it odd, but a variable name made of numbers is legal, but of little help.
This is a special variable because its value is already filled out - it refers to whatever congregation you have marked as your local on the Congregations Maintenance Window.
If you have not filled out this bit of information, then the $LocalCong variable will default the value to "Local" which will likely produce unexpected results.
These are also special variables which have their values already filled out. They all contain the appropriate date in a special format: #YYYY MM DD#. These date variables are designed to be used with LOOP and IF custom report script commands. Specifically, they should be used with any database fields of type date (that is - TIMESTAMP).