TSSSX Scripting Overview
The Team Sports Scheduling System Report Template File (TRT File)
for (i = 0; i < 3; i++)
Response.Write(i + " ");}
The above code would output the following result:
Using VBScript in TRT Files
To use VBScript as the scripting language in a TRT file, add the following directive to the first line in the file:
<%@ Language=VBScript %>
Special Processing Instructions
To generate the website, a few special instructions needed to be introduced. Namely, running the same report for every item type in the project (i.e. running the team.trt web page report for every team in the project). These special processing instructions are described below.
The context-loop tag tell TSSS to repeat the report for every item specified in the context-loop. Also, a global variable is added to the report so the script can access the current item. Listed below is a table containing the Value that can appear between the context-loop tag, the associated Global Variable Name that will be available in the script, and a Description of what is looped through.
The above example combined two values to create two loops. This example would have the current report repeated for every team in every league. The current league and team can be accessed in the report by the League and Team global variables.
|FILENAME||The filename tag allows you to specify the filename and extension to use for the report. If
the filename tag appears in a script containing a CONTEXT-LOOP tag, the context-loop item's ID is
prepended to the filename. For example:
The above tag would have the reported saved as 'schedule.csv'.
|TSSS-INFO||TSSS looks for this section in a Report TRT file so it knows the type of output, and can
display the description and author information to the end user. The following tags are supported
inside the <TSSS-INFO> </TSSS-INFO> tags:
|<!--# include file="filename.inc"-->||Use this syntax to include another file into the report.|
|<%= someVariable %>||
This is shorthand notation which writes out the someVariable variable to the output file. This gets translated to:
<% Response.Write( someVariable ) %>
Support Functions available in the Include Files
There are a number of helper functions available in the serverscripts.inc include file. These include date & time formatting functions. You can add your own functions to serverscripts.inc, or add them to the clientscripts.inc file.
Built-In Global Variables
There are three built-in global variables which are available in every script. These are listed below.
The globals.inc File
The globals.inc file contains global variables which are currently used by some of the functions in the serverscripts.inc file. Current settings to swap the Home/Away columns (so the Away column is before the Home column), and which Date & Time formats should be used. If you need to add global settings that will be available to all scripts, add them to this file.
How it all Works
The Team Sports Scheduling System parses the data in the TRT file, wraps all the normal text in a code block, combines all the code blocks together with the included files, and inserts it into the base trt file (which contains the logic for creating the output files and loading the scheduling project), and then runs the resulting file through Windows Script Host. The temporary script and report files TSSS creates are deleted when the program is closed.
The best examples are working examples. Check out the .TRT files used to create the website in the TSSS Folder\Templates\Default, and the custom reports in the TSSS Folder\Reports.