-
Notifications
You must be signed in to change notification settings - Fork 0
pts tutorial3 module1
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.
$LocalCong 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. |
|---|
| $Today $LastWeek (today - 7 days) $LastMonth (today - 31 days) $NextWeek (today + 7 days) $NextMonth (today + 31 days) $NextSixMonths (today + 183 days) $NextYear (today + 365 days) $NextTwoYears (today + 731 days) $NextQuarter (today + 91 days) 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). |
Copyright © 2002 - 2025 by Andrew Truckle. All Rights Reserved.
- Using Public Talks
- Main Application Menu
-
Database Ribbon Panel
- Assignments Editor
- Backup Database
- Check Talk Exchange
- Compact Database
- Convert Database
- Create Unassigned Date Entries
- Database Security
- Maintain Databases
- Purge Database
- Rearrange Dates
- Restore Database
- Help Ribbon Panel
-
Home Ribbon Panel
- Create a Report
-
Manage Custom Reports
- Editing Scripts
- Content Ribbon Panel
- System Ribbon Panel
- Script Command Syntax
-
Tutorials
- Using The Script Editor
-
How To Write Scripts
- Module 1 - The Basics
- Module 2 - Hello, World!
- Module 3 - Multiple Text Blocks
- Module 4 - It's A Date, Then
- Module 5 - Oh, I'm Blushing!
- Module 6 - It is a Rainbow!
- Module 7 - The Font Of All Knowledge
- Module 8 - Queue To The Right
- Module 9 - Memory Like An Elephant
- Module 10 - May I Squeeze In There?
- Module 11 - Move Over, Please
- Module 12 - You Move Over Here
- Module 13 - Is My Back A Funny Colour?
- Module 14 - I'm Going Loopy Here!
- Module 15 - Fields Of Golden... Text
- Module 16 - Man, That Looks Weird
- Module 17 - Inner Peace, Inner Loop
- Advanced Script Features
- Quick Access Toolbar
- Settings Ribbon Panel
- Tools Ribbon Panel
- Revision History
- Contact Information
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