| SATFORM Examples |
|
| Home | SATGUI | SATSHELL | SATFORM | SATFILTER | SATREPORT | SATMYSQL | License | Download | Examples | Contact |
A "Account Balance" letter. The source data for this letter is a colon delimited text file, formatted using an awk script.
This example uses bold/underline/italic attributes. Variable and Predefined data (unmodified and using mixed case conversion). Positioning text. Conditional/Calculation Macros. Labeled text blocks. Passing variable data through the command-line.
| Sample Output |
Account in credit
Account in debit
| Example SAT/ML |
Assume a file called accountbalance in the $SATHOME/form directory with the following contents:
<body>
<@ 50>Reference:<@ 58>AD001
<@ 50>Date:<@ 58>${DATE}
<@ 50>Tel:<@ 58>555-9876
<indent 10>
%{title} %{firstname} %{lastname}
${houseno} %{street}
%{town}
<size 15><b><u>Banking Charges</u></b><size 12>
Dear %{title} %{lastname},
This letter is to inform you of the revised Banking Charges for the year 2001.
We have tried very hard over the last year to keep costs down, and as a result
Our charges will be abolished for accounts in credit. For accounts in debit there
will be a charge of $10.00 per month.
In addition debit balances must be reduced by at least 10% of the outstanding
amount per month, otherwise there will be an extra penalty charge of $15.00.
Your account balance as at ${BALANCEDATE} was <abs ${balance}> {${balance}:<:0.00;Debit;Credit}.
{${balance}:<:0.00;<insert debit-text>;<insert credit-text>}
Yours,
Frank Stapleton
(Senior Banking Manager)
</body>
<label credit-text>
As your account is in credit there will be no Banking Charge for this month.
</label>
<label debit-text>
As your account is in debit $10.00 has been charged. Your new balance will be
<abs {${balance}:-:10.00}> Debit. You will need to reduce your balance by {${balance}:/:10} by the end of
the month to avoid the extra penalty.
</label>
| Example Variable Data |
Assume a file called accountbalance.dat with the following contents:
MR:JOHN:SMITH:12:HIGH STREET:TOWNSVILLE:250.16 MISS:MARY:JONES:98:LONG ROAD:TOWNSVILLE:2078.42 MR:FRED PETERS:78:GREEN AVENUE:RIVER CITY:-137.18
| Example Script to Format Data |
Assume the printer to be used is called printer1. The following script will print an "Account Balance" letter for each record in the accountbalance.dat file.
NOTE: In this example the variable data item BALANCEDATE is passed through the satform command-line. The name of a variable data item passed through the command-line is always converted to uppercase.
nawk '
{
print "title\034" $1
print "firstname\034" $2
print "lastname\034" $3
print "houseno\034" $4
print "street\034" $5
print "town\034" $6
print "balance\034" $7
print "\f"
}' accountbalance.dat | satform accountbalance balancedate="03/22/2001" | lp -dprinter1 -onobanner