18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Commands<br />

DefCur A-D sets the characters A, B, C and D to be typed as currency data<br />

types automatically. As with DefInt, subsequent reference to A through D<br />

will be treated as currency types. Notice that character settings are case<br />

sensitive; A-Z and a-z represent two possible sets of variables that can be<br />

defined through these DefType statements.<br />

Collections<br />

Collections is a <strong>Visual</strong> <strong>Basic</strong> Release 4 addition that allows you to set up<br />

array-like constructs; it can hold multiple types of data elements including<br />

class-based objects that you create yourself. Collections is handy in <strong>Visual</strong><br />

<strong>Basic</strong> and has a number of operations (such as .Add, .Delete, etc.) that can<br />

be per<strong>for</strong>med directly against the collection, but collection processing can<br />

be somewhat slower than processing against more traditional array<br />

constructs.<br />

The <strong>Visual</strong> <strong>Basic</strong> Collection keyword is not supported in <strong>LotusScript</strong>. Using<br />

the line Dim myUsers as New Collection results in a “Class or type name<br />

not found: COLLECTION” message. <strong>LotusScript</strong> handles collections as a<br />

Notes class. <strong>Visual</strong> <strong>Basic</strong> collection-based code will need to be changed to<br />

array-based logic when ported to <strong>LotusScript</strong>.<br />

Operators<br />

Both <strong>Visual</strong> <strong>Basic</strong> and <strong>LotusScript</strong> share the same + - / * ^\ MOD<br />

operators, which have the same precedence. The <strong>Visual</strong> <strong>Basic</strong> XOR, AND,<br />

NOT, OR, EQV and IMP operators are also found in <strong>LotusScript</strong> and<br />

support bit-wise operations. Both languages provide the Like<br />

pattern-matching operator <strong>for</strong> use on strings.<br />

<strong>LotusScript</strong> uses most of the same syntactical statements and structures that<br />

you will find in <strong>Visual</strong> <strong>Basic</strong>. A very short list of <strong>LotusScript</strong> supported<br />

statements and functions includes: Fix, FreeFile, GetObject, Hour, InStr,<br />

IsDate, Kill, LBound, Mid, Option Base, ReDim, Seek and Val. Now even<br />

returns the system date and time in the same <strong>for</strong>mat as <strong>Visual</strong> <strong>Basic</strong>.<br />

Both <strong>LotusScript</strong> and <strong>Visual</strong> <strong>Basic</strong> support multi-line statements, using the<br />

‘_’ character to end the line, preceded by white space.<br />

<strong>LotusScript</strong> uses the C-like %Rem...%End Rem statements to comment or<br />

uncomment more than one contiguous line at once.<br />

8 <strong>LotusScript</strong> <strong>for</strong> <strong>Visual</strong> <strong>Basic</strong> <strong>Programmers</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!