|
Macros
Macros are used by BookingBuilder Desktop to enter information into the GDSes, and to read data from the GDSes. Macros are like a mini programming language, or script, and the macro capabilities in BookingBuilder Desktop are extremely powerful.
Entering Data Into the GDS
A typical macro might look like this:
5THE NAME IS {LastName}/{FirstName}
[IF {CCNumber} <> '']5THE CREDIT CARD IS {CCType}{CCNumber}[END IF]
5THIS WAS ENTERED ON {Today:DDMMM}
Each line represents a command to be sent to the GDS. Variables are inside curly braces, such as {LastName}. If the traveler's name is PAT JOHNSON, the first line above will send this command to the GDS:
5THE NAME IS JOHNSON/PAT
Conditional Logic
The next line begins with [IF {CCNumber} <> '']. BookingBuilder Desktop will first check to see if the {CCNumber} is empty. If not, it will proceed with what comes after the [IF ...]. You could also do:
[IF {CCType} = 'AX']AMEX[ELSEIF {CCType} = 'DS']DISCOVER[ELSEIF {CCType} = 'VI']VISA[ELSE]OTHER[END IF]
In this case, if the {CCType} is 'AX', it will send AMEX. If it's not 'AX', it will then check to see if it's DS, and, if so, send DISCOVER. If it's not DS, it will check for 'VI', and, if not, then it will send OTHER. You can also "nest" IF statements:
[IF {CCType} = 'AX'][IF {VendorCode} = 'B6']THANK YOU FOR USING AX WITH JETBLUE[END IF][END IF]
In this case, if both the {CCType} is 'AX' and the {VendorCode} is 'B6', it will send the command. Note that for each [IF] you need one [END IF]. You can have muliple [ELSE IF] with each [IF] and only one [ELSE] per [IF]. For text, you must use either single or double quotes, such as 'AX' or "AX". You do not use them for numbers and dates, such as:
[IF {PassengerCount} > 1]YOU HAVE MORE THAN ONE PASSENGER[END IF]
The supported comparisons are = (equals), < (less than), > (greater than), <> (not equals).
With BookingBuilder Desktop Build 127 and newer, [BLOCKIF] was added:
[BLOCKIF {VendorCode} = 'B6]
THIS IS A JETBLUE BOOKING
MORE INFORMATION FOR JETBLUE
[BLOCKELSE]
THIS IS NOT A JETBLUE BOOKING
MORE INFORMATION FOR NON-JETBLUE BOOKINGS
[END BLOCKIF]
[BLOCKELSEIF] is also supported, and you can nest [BLOCKIF] statements. This makes it much easier to send separate sets of commands based upon certain conditions. Note that the [BLOCK...] and [END BLOCKIF] commands must be the only text on a line. Within each "block" you can still use the regular [IF] and all other macro commands.
Formatting Dates and Numbers
THE PRICE IS {TotalFare:0.00} ON {Today:DDMMM}
That macro will send something like:
THE PRICE IS 149.12 ON 15JUN
{TotalFare:0.00} means use "0.00" as the format. This forces two decimal places. For dates and times, you can use DDMMM or DDMMMYY or DDMMMYYYY for GDS date formats. For times, H is for the hour, N for minute, and S for seconds, such as {Today:DDMMMYY HHNNSS}.
Math
You can also include many different math functions, such as:
ADD A RETENTION LINE FOR {OutboundDate+90:DDMMM}
That will enter the date 90 days after the outbound date, in the standard GDS date format. You can also add variables:
{BaseFare + TaxAmount}
All standard math operations are supported.
Additional Functions
Starting with BookingBuilder Desktop Build 127, you can do the following:
You can add comment lines:
//This is a comment and will not be sent to the GDS
{GDSSend:*I}
That will send "*I" to the GDS. It's same as just putting "*I" on a line, but sometimes it can be a little more clear to do it this way.
{GDSSendMD:*I}
This will send the command, and then send as many MD commands as necessary to get the entire response. It will put the various screens together and remove any overlap if your GDS repeats data on the last screen. This is normally used with {ReadResponse}, which is discussed below.
{UserPrompt:}
This allows you to ask the user to enter information. The User Prompt Builder will create the actual command for you. This is very useful, for example, if you need to enter a specific tax amount. You can use [BLOCKIF] to see if BookingBuilder Desktop was able to get the tax from the supplier site. If not, ask the user to enter it.
[EXIT]
This exits the current macro. No lines after the [EXIT] will be processed.
Reading GDS Data
BookingBuilder Desktop Macros have two ways to read GDS data, but they work the same way. Certain older screens ask for the GDS command and the read expression; newer screens, just let you build the entire macro yourself, which gives more flexibility. Since the concepts are the same, this will show the new way (available with Build 127 and newer):
{GDSSend:*F#}
{ReadResponse:{VendorCode}{FFNumber:[0-9]+}}
If the {VendorCode} is B6, and the GDS response is:
1.B61234567890
2.ZZ0987654321
This will look for the line with B6 followed by numbers, and read those numbers into {FFNumber}. The [0-9]+ is a regular expression. The best way to learn and create regular expressions is to get RegexBuddy.
Note: The regular expressions are case-sensitive, meaning that if you put in a lowercase letter, then only a lowercase letter will be matched. To create a case-insensitive expression, put (?i) at the beginning of your expression. This is required at the beginning of each group within your regular expression.
Multiple variables can be read as well. When you create the read expression, existing variables are first filled in. For example, the above has:
{ReadResponse:{VendorCode}{FFNumber:[0-9]+}}
Since {VendorCode} already exists, BBD looks for "B6[0-9]+". If you are reading data into a variable, and you are not sure if the variable might currently have data in it, you should first clear it:
{ClearVariables:{FFNumber},{AnotherVariable}}
In general, it's good practice to always use {ClearVariables:} before {ReadResponse}.
Please note that starting with BBD Build 127, you can use {ReadResponse} after any macro line that sends a GDS command. This makes it easy, for example, to find segment numbers so that other items can be matched to segments just sold by the macros.
Please note that starting with BBD Build 131, you can specify the data type when reading GDS data. With Build 131, by default all data read from the GDS is considered a string, meaning that it is text. This could cause a problem if you read numbers and then want to use them in a math function. When you read numbers or dates, you should specify the type, such as:
{VariableName As Number:[0-9]+} This means that it will be considered a number. If you leave out the "As" and a type, it will be read as a string. The type names that can come after the "As" are:
| String |
Text |
| Boolean |
True or False. It must find "TRUE" or "FALSE" when reading from the GDS . |
| Date |
Must in the form mm/dd/yyyy |
| ShortDate |
The standard GDS Date format, such as 15JUN |
| Number (or Double) |
Any numeric value, including decimals. |
| Integer (or Long) |
Any numeric value without decimals. |
| GDSDate |
Same as ShortDate. Just a name that is more clear. Introduced in BBD Build 161. Like ShortDate, this reads 1 or 2 digits, then a month, and an optional year. The year can be specified with 2 or 4 digits, such as 15JUN07 or 15JUN2007. |
| GDSPastDate |
Reads a GDS date as a past date if the year is not specified. If the current date is 20NOV2006 and it reads 15JAN, it will be 15JAN2006 instead of 2007. Introduced in BBD Build 161. |
Preset Variables
Certain variables are always present. All others will vary based upon the purpose of the macro.
| {Today} |
Today's date |
| {Tomorrow} |
Tomorrow's date |
| {ComputerCountryCode} |
The country code of the computer, such as "US" or "CA" |
| {BBDBuildRevision} |
The Build Number of BBD, such as 127. (Available in Build 111 and later) |
| {GDSName} |
AMADEUS, APOLLO, GALILEO, SABRE or WORLDSPAN (Available in Build 161 and later). This is name of the current GDS. This is only available in macros that can access multiple GDSes. |
| {SetGDS:Worldspan} |
Sets the GDS to receive the commands. This is only available in macros that can access multiple GDSes, and in Build 161 and later. You should always check {GDSName} after calling {SetGDS} to ensure that the requested GDS is available. The GDS name can be upper or lower case. This must be the only macro command on its line. |
| {PromptForGDS} |
If more than one GDS is installed, this displays a list of those available, and returns the name of the GDS selected. If only one GDS is open, this does not show any dialogs to the user. This is only available in macros that can access multiple GDSes. |
User Prompt Builder
|