CCS Script

The CCS shell utilizes a scripting language called CCS Script. This easy-to-learn script allows many syntax variances and recognizes many keywords from several popular programing languages including C, Java, and BASIC. Via CCS Script you can completely control both the flow and the functionality of any CCS Program.

The scope of this manual is not intended to cover the details of CCS Script. Such information can be obtained by contacting CCS and requesting a free CCS Script Reference Manual. A more in-depth overview of CCS Script is currently in development and will be available for download in the near future via the CCS Website.

 

CCS Script Overview :

Syntax:

All statements end with a semicolon. Single expressions can be one or more lines long. All white space characters (tabs, spaces, new lines etc.) are ignored except in the definition of function names, variable names, keywords and mathematical operators. (<= is valid whereas < = is not).

All functions must begin with the char @. Parameters must be comma separated and enclosed in parentheses. Example: @Left("Mystring", Count);

Constant strings must be enclosed in double quotes. Example: MyString = "This is a string"; ThisIsNot =0; The expression ThisIsNot will be interpreted as a numerical variable and assigned the value of zero.

User-defined functions and variable names are case sensitive. MyVariable() is not the same variable as @myvariable. CCS Script keywords and predefined functions are not case sensitive. Therefore, @MakeUpper(); is the same predefined function as @makeupper();

Statement Blocks start and end with curly brackets {}. Example: If(A==1) {@Fail();};

Assigning a value to a variable defines the variable if it does not exist.

Variables are coerced to the type they are last assigned.

Example: MyDate = @CurrentDate(); creates a date type variable and assigns the current system date to the variable MyDate. If the next statement reads MyDate = "This is a Date"; then the variable MyDate will be coerced to a string type variable.

A variable must be defined or declared prior to its use as a function parameter.

The expression A==1 compares the variable A with the constant value of 1 and returns a Boolean true or false. The expression A=1, assigns the value of 1 to the variable A.

Therefore the statement If(A=1) {....} will assign the value of 1 to A, then, since the value of A is "TRUE", the IF's body will be executed every time. This functionally is extremely useful when both assignment and comparison are desirable in one step.

Automatic type conversion is done when differing variable types are used in a mathematical expression. Example:

MyDate = @CurrentDate() + 1; will add one day to the system date and assign it the variable MyDate typed as Date.

MyString = "1234" + 2; will convert (if possible) MyString to an integer, add the value 2 to the conversion result, and assign this value (1236) to MyString, which will become a numeric type.

Automatic conversion can be overridden or controlled by the functions @Long, @Int, @Real, @Float, @StringDate and @ParseDate.

Operators:

The syntax of the CCS Script is very similar to Java Script and C. All basic mathematical functionality of Java Script is supported in CCS Script, including +, -, /, * and % (remainder).

The Boolean operators <,>, <=, >=, = (assign), == (compare), ! (not), != (not equal) are supported.

The "IF" statement is fully supported. However, at this time the "ELSE" statement is not. The expressions of an If statement can include If statements: there is no limit to the nesting level.

The "IF" keyword need not be preceded by the @ char.

When multiple expressions are to be executed by an If statement that evaluates as TRUE, they must be enclosed in curly brackets. When Curly brackets are not used, only the expression up to the next semicolon is executed in conjunction with the If statement.

In the following example, the two message boxes will never be displayed (the If statement will always evaluate to false).

If(1==2)

{

Alert("This will never be displayed");

Alert("Nor this message");

}

In this example, the second message will be displayed since it not a part of the If statement.

If(0)

Alert("This is a message that will not be displayed");

Alert("This message will be displayed");

 

Function Reference:

String Functions:

IsBlank

OnlyChars

OnlyText

IsInStr

StrCmp

StrLen

Left

Right

Mid

MakeUpper

MakeLower

EscapeString

BackSlash

 

Extensibility:

CallMethod

CallDll

LoadMethod

SendMessage

PostMessage

ClickButton

PostClickButton

Conversion:

Float , Real, Double

Int, Whole, Long

Date Functions:

StringDate

ParseDate

CurrentDate

DateCmp

Data Source Functions:

ProcessKeyField

Locate

AlphaSearch

SelectField

CurRecSet

IsColumnModified

CurTable

CurCol

Form and Cursor Level Functions:

EDITMODE

ADDMODE

Define

GetModified

SetModified

GetField

GetEntry

SetEntry

GotoNext

GotoPrev

IsInCombo

Update

 

Logic Control:

If

EvalBlank

SetError

Stop

Fail

Alert

 

Note: Most of the above functions are utilized by the validation logic itself shipped with your CCS Accounting program. Viewing their use in these Validation methods is a first step to understanding both the syntax and capability of CCS Script.

Also note, when you attempt to call a function with the wrong type or number of parameters, you will receive a "Usage" dialog if and when the Validation Method is utilized. This message box will display the proper syntax to be used with the function.