Contents 

Fast Start
Weight Scale Interfacing (Digi D770)
What Is Visual Builder?
What's New In Visual Builder?
Creating A CAPITAL Form
Creating a Form - Conceptual Overview
Creating a Form - Quick Guide For Advanced Users
The Forms Wizard
Creating A CAPITAL Report
The Label Wizard
Report Wizard Tutorial
New & Revised Topics in CAPITAL 7.5
AllocatePayment()
CrossTab()
CreateTable()
EventAdd()
FilterTable()
Find()
PayMethodName()
ReadINI()
SendHTMLMail()
TranInfo()
WriteNote()
New & Revised Topics in CAPITAL 7.41
AddPayment()
Business Functions Listing
BufferCommit()
BufferRollBack()
BufferUpdates()
ExportASCII()
GetFolder()
KitList()
LockRecord()
ReadNote()
ReadTextFile()
StockQuantity()
StrWrap()
WriteTextFile()
New & Revised Topics in CAPITAL 7.4
Business Functions Listing
CompanyName()
Department()
Field Objects
JobInfo()
Linking
Moving & Resizing Body Objects
Operators & Expressions
OrderTable()
PathData()
Picture Object Properties
ReadINI()
ReadNote()
RunApplication()
Sample Scripts
Send Product Info Email With Pictures
Start-up Switches
StockAnalysis()
TagInfo()
TranWrite()
WriteINI()
New & Revised Topics in CAPITAL 7.3
AddStock()
AddTraceProperty()
BackAllocate()
Business Functions Listing
CardFileBill()
ComError()
ComClose()
ComOpen()
ComRead()
ComSetup()
ComWrite()
ComputerName()
EchoBox()
EchoBoxOn()
EchoBoxOff()
LockSemaphore()
PasswordInfo()
ScriptRun()
TodoAdd()
Trouble-Shooting Guide
UnlockSemaphore()
New & Revised Topics in CAPITAL 7.2
Business Functions Listing
ImportASCII()
Journal()
ReadNote()
StockGetQuantity()
StockQuantity()
TimeFormat()
Version()
Basic Editing
Moving & Resizing Objects
Moving & Resizing Body Objects
Creating Forms & Reports
Form Bodies
Form Design Hints & Tips
Body Properties
Body Contents
Rule Wizard
Rule Wizard Guidelines
Body Rules
Group Wizard
Body Groups & Totals
Form Output Properties
Form Notes
Question Wizard
Form Question Prompt
Form Questions
Preface and Postscript Scripts
Form Dictionaries
Page Setup
Form Editor Preferences
Field Objects
Field Formulas
Bar Code Field Objects
Text Object Properties
Picture Object Properties
Linking
Why are Table Joins Necessary?
Linking Forms - Concepts
Linking Forms - Tutorial
Linking Forms - Hints & Problem Solver
Special Topics
CAPITAL Data Browser
Bar Codes - An Overview
Cross-Tab Concepts
Cross-Tabs
Cross Tab Fields
Cross-Tab Hints & Tips
Exporting Data
Printing
Transaction (Form) Printing
The Print Job Manager
Windows Printing Concepts
Script Programming
Business Functions Listing
Capital Business Script
Variables & Data Types
Scope
Operators & Expressions
Type Conversion
Business Functions Overview
Commands
CALL
DEBUG
GOTO (label)
IF (expression) GOTO
IF (expression) ... ELSE ... ENDIF
PAUSE
REM (*)
RETURN
Visual Forms Builder Special Variables
Sample Scripts
Sending Email Using CBS
Programmer's Frequently Asked Questions
Business Functions
AAdd()
Abs()
AddCustomer()
AddJobCard()
AddMail()
AddPayment()
AddRecord()
AddStock()
AddTraceProperty()
AllocatePayment()
Alltrim()
AnswerYes()
ArraySort()
Asc()
AsChar()
ASIZE()
AsTran()
AsVal()
AT()
BackAllocate()
BPayCRN()
BPayError()
BufferCommit()
BufferRollBack()
BufferUpdates()
CDOW()
Ceil()
CHR()
CloseFile()
CloseIndex()
CloseTable()
CMONTH()
CompanyName()
CompressTable()
ComError()
ComClose()
ComOpen()
ComRead()
ComSetup()
ComWrite()
ComputerName()
CopyFile()
CopyRecord()
CopyToClipBoard()
CreateFile()
CreateEmailJob()
CreatePrintJob()
CreateTable()
CrossTab()
CTOD()
DateFormat()
DateFromMonth()
DAY()
Dictionary()
DOW()
DTOC()
DTOS()
Echo()
EchoBox()
EchoBoxOff()
EchoBoxOn()
EchoStatus()
Eof()
EraseFile()
EventAdd()
ExpenseAnalysis()
ExportASCII()
FilterTable()
Find()
FindWindow()
ForDate()
FormAdd()
FormResult()
FreeCPU()
FormCreate()
FormShow()
GetField()
GetFolder()
Goto()
GotoBottom()
GotoTop()
HoldRecord()
GroupChange()
Idle()
IF()
ImportASCII()
IndexTable()
Input()
InputFile()
INT()
IsEmpty()
IsFile()
IsFileEnd()
IsLayBy()
IsPaid()
IsPayment()
JobInfo()
JobPriority()
JobStatus()
KitList()
LEFT()
LEN()
LockRecord()
LOWER()
LTRIM()
Max()
Min()
ModemDial()
Month()
MonthEnd()
MonthStart()
NTrim()
NumToWord()
OpenFile()
OpenTable()
OrderTable()
OpenVisualBuilder()
Pad()
PathCompany()
PathProgram()
PayMethodName()
PostMessage()
PriceUpdate
RAT()
ReadFile()
ReadNote()
ReadFileLine()
ReadTextFile()
RecNo()
RenameFile()
Replicate()
Right()
Round()
Rtrim()
RunApplication()
Seconds()
Security()
SendDirect()
SendMail()
SendEscapeCodes()
SendMail()
Shell()
Skip()
Space()
SpecialName()
SpecialPrice()
SQRT()
StockAnalysis()
StockDescription()
StockMovement()
StockPrice()
StockId()
StockQuantity()
Str()
StrLine()
StrLineCount()
Strtran()
StrWrap()
Substr()
StrZero()
Time()
Today()
TodoAdd()
TranAdd()
TranCreate()
TranWrite()
TranInc()
Transform()
TranStr()
Type()
UnlockRecord()
Unpaid()
Upper()
UserName()
UserNumber()
Version()
WaitCursor()
WaitFile()
Week()
Write()
WriteFile()
WriteFileLine()
WriteNote()
WriteTextFile()
Year()
ZipFile()
Tutorials
Report Wizard Tutorial (Basic)
Label Wizard Tutorial (Advanced)
Forms Library
The Visual Builder Report & Forms Library
Forms Stationary
Report Library - Customer Transactions
Report Library - Cash Management
Report Library - Sales Analysis
Report Library - Sales Orders & Back Orders
Report Library - Stock Control
Report Library - Service Management & Periodic Billing
Report Library - Special
Appendix
Moving Forms
Logging On
Overriding Print Warning Messages
Questions & Answers
Start-up Switches
Trouble-Shooting Guide
Weight Scale Interfacing (Digi D770)
Working With Text Printers

CAPITAL Series 7 Visual Builder Reference Guide

Prev Page Next Page

Operators & Expressions generate/en74.gif


CAPITAL Business Script is made up of three core elements:

Operators

These range from simple assignments (:=) to complex mathematical operators such as modulus (%). They can also be used for the combination of character strings, creating relations between data files, and comparison.

generate/redtrafficlight.jpgA common mistake new users make is to mix the "=" (is equal to) operator with the ":=" (assign value) operator. In some languages the syntax of these operators are interchangeable. They are not interchangeable in CAPITAL Business Script. You must always use the := operator to guarantee correct assignment of values to variables.

Procedure

A procedure is CBS jargon for a unit or block of program code or "script". A block can consist of as little as one or two CBS statements, and as much as 64K worth of lines. Other languages commonly refer to procedures as "sub routines" or "methods".

Return

A procedure finishes when the Return command is reached or when the last command in the procedure is executed. When the Return command is encountered program control passes back to Visual Builder, or if a procedure was called from another procedure, to the upper level procedure that initiated the call. There may be any number of return commands in a procedure. The format of the command is:

RETURN <exp>

where the <exp> is the data item to be passed back. It is usually very important to include a RETURN statement in a procedure so that CAPITAL will know the result of the operation and take appropriate action. If a procedure does not include a RETURN statement then execution continues until the last executable statement is reached. An empty string ("") is usually returned as the default result if no result is specified. However, the return result may vary if not specified explicitly in the script. Therefore its always recommended to include a RETURN statement if the script extends over more than one line.

Arithmetic Operations

The symbols * , / , % , + , - , and ** are the arithmetic operators available in CBS. These symbols along with the brackets ( ) and the = and := assignment operators are used to perform arithmetic functions. Consider this algebraic expression:

Average : = (John + David + Pete) / 3

This adds the variables John, David and Pete together, divides the total by 3 and places the result in the variable Average. As CBS adheres to the order of precedence defined in mathematics, if the brackets were omitted CBS would divide Pete by 3 and then add it to John and David. This is not the desired result, hence the inclusion of the brackets. It is always recommended that brackets be included in calculations to eliminate ambiguity.

Operator

Meaning

*

Multiply

/

Divide

%

Modulus

+

Add

-

Subtract

**

Exponential

$

Within operator (string comparisons only)

<>

Not equal

#

Not equal

Character Operators

Of the arithmetic operators mentioned above, the assignment and addition operators have uses in character expressions. To concatenate (join) two strings simply add them together as you would two numbers in a mathematical expression:

FullName : = 'John ' + 'Nugent'

This will result in the string "John Nugent" being placed in the variable FullName.

Date Operators

To create a date variable either declare the variable as a date type or use the CTOD() (character to date) function and pass it the date as a string. The TODAY() function also returns the system date as a date variable.

Once you have a date variable you can use + and - to add or subtract a number of days. You can also use - to subtract one date from another in which case the result is the number of days between the two dates.

This expression defines a date as the 1st of March 1999:

MyDate := CTOD('01/03/1999')

This statement converts the string "01/03/1999" into a date variable. Note the format which is:

DD-MM-YY. (2 digit day, 2 digit month, 2 digit year.)

Array Operators

As well as being variables, arrays are complex data structures. Each element of an array can be of any data type so the operations that can be performed on an array element are the operations which are valid for any variable of that type. There are several operations that can be performed on an array that are concerned with the creation and sizing of the array.

An array can be created by either declaring a variable as an array or assigning {} brackets to a variable that has already been declared. For example:

Array1 : = {}

You can also assign data elements to the array like so:

Array2 : = {3, 2, 1}

Array2 contains three numeric elements into which the values 1, 2, and 3 are placed. To access the third element of array Array2 use:

MyVar := Array2[3]

In the above example MyVar will be assigned the number 1, which is the third element of the array. In CBS, arrays start from element 1, not zero as in some other programming languages.

Comparison Operators

These are used to compare the contents of variables and the results of functions and expressions.

Operator

Description

#

Not equal (mathematical evaluation)

<>

Not equal (mathematical evaluation)

!

Not equal (logical evaluation)

$

Within (character strings only)

<

Less than

>

Greater than

<=

Less than or equal

>=

Greater than or equal

=

Equal (numeric) or match (string)

==

Equal to or exact string match

Example statements include:

If MyValue <> 50

   * Does not equal 50

Endif

If ! lLogical

   * If lLogical = FALSE

Endif

If "PETER" $ "PETER BOWER"

   * The string "PETER" is within the string "PETER BOWER"

Endif

If "PETER BOWER" = "PETER"

   * True because all the characters of the

   * first string match the characters of

   * the second string

Endif

If "PETER BOWER" == "PETER"

   * FALSE because the character strings

   * are not an exact match

Endif

Logical Operators

Comparison operators can be combined together using the logical operators .AND. .OR. and .NOT. to check multiple conditions and ranges at once. For example, this statement checks if the variable MyValue is greater than 100 but less than 200:

If MyValue > 100 .AND. MyValue < 200

   * Do something if between 101 and 199

Endif

This statement checks if MyValue is either 1 or 2

If MyValue = 1 .OR. MyValue = 2

   * Equals 1 or 2

Endif

Special Punctuation

Symbol

Meaning

*

Comment line

;

Wrap line

 

Place a * (asterisk) in front of a line to have CBS ignore processing of that line.

Place a ; (semi colon) at the end of a line to let CBS treat the next line as a continuation of the existing line.

____________________________

Related Topics

CAPITAL Business Script