Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

B. 1 Introducing Basic Syntax

Chapter 7 taught you how to program using Crystal syntax. This appendix builds on that chapter by showing you details of the Basic syntax. It was written as a companion tutorial with Chapter 7 that shows what is unique about Basic syntax compared to Crystal syntax. It doesn’t try to teach you programming all over […]

B. 2 Data Types and Variables

Simple Data Types Basic syntax uses the same data types as Crystal syntax. However, the naming convention varies slightly. In Crystal syntax all data type have “Var” at the end (e.g. NumberVar, StringVar, etc.) Basic syntax doesn’t use the “Var” suffix after each data type. It simple uses the data type name by itself: Boolean, […]

B. 3 Arrays and Ranges

Array Data Types To declare an array variable in Basic syntax, use a set of parentheses in the variable declaration. Dim X() As String To reference an element of the array, use parentheses with the index number. X(1) = 5 Formula = X(3) The ReDim statement changes the number of elements in the array and […]

B. 4 Conditional Structures

Conditional Structures The If statement uses the standard syntax of testing a condition and performing one action if the condition is true and another action if it’s false. The code in the Else block is executed if the test returns false. Basic syntax also supports the ElseIf statement. An If block must always be finished […]

B. 5 Looping Structures

Looping Structures Looping structures let you execute a block of code multiple times. The number of times this code block is executed depends upon the type of loop used and what happens within the code block. The looping structures covered are: For Next, While, and a variety of Do loops. For Next Loop The For […]

B. 6 String Functions

Function Conversion Charts The following charts show the equivalent functions between Basic syntax and Crystal syntax. Though many are the same, each table does have a few variations listed. The tables use the same table numbers so that you know where they are in the book and you can reference the sections if you need […]

B. 7 Data Type Conversions

Table 6-5. Conversion Functions Basic Syntax Crystal Syntax CBool(number), CBool(currency) CBool(number), CBool(currency) CCur(number), CCur(string) CCur(number), CCur(string) CDbl(currency), CDbl(string), CDbl(boolean) CDbl(currency), CDbl(string), CDbl(boolean) CStr() CStr() CDate(string), CDate(year, month, day), CDate(DateTime) CDate(string), CDate(year, month, day), CDate(DateTime) CTime(string), CTime(hour, min, sec), CDate(DateTime) CTime(string), CTime(hour, min, sec), CDate(DateTime) CDateTime(string), CDateTime(date), CDateTime(date, time), CDateTime(year, month, day) CDateTime(string), CDateTime(date), CDateTime(date, time), […]

B. 8 Math Functions

Table 6-8. Math Functions Basic Syntax Crystal Syntax Abs(number) Abs(number) Ceiling(number, multiple) Ceiling(number, multiple) Fix(number, decimals) Truncate(number, decimals) Int(number), numerator \ denominator Int(number), numerator \ denominator Pi Pi Remainder(numerator, denominator), Remainder(numerator, denominator), numerator Mod denominator numerator Mod denominator Round(number, decimals), RoundUp(number, decimals) Round(number, decimals), RoundUp(number, decimals) Sgn(number) Sgn(number) Sqr(number), Exp(number), Log(number) Sqr(number), Exp(number), Log(number) Cos(number), Sin(number), Tan(number), […]

B.9 Date and Time Functions

Table 6-10. Date and Time Functions Basic Syntax Crystal Syntax CurrentDate, CurrentTime, CurrentDateTime CurrentDate, CurrentTime, CurrentDateTime DateSerial(year, month, day), DateTime(hour, minute, second) DateSerial(year, month, day), DateTime(hour, minute, second) DateAdd(interval, number, date) DateAdd(interval, number, date) DateDiff(interval, startdate, enddate, firstdayofweek) DateDiff(interval, startdate, enddate, firstdayofweek) DatePart(interval, date, firstdayofweek, firstweekofyear) DatePart(interval, date, firstdayofweek, firstweekofyear) MonthName(date, abbreviate) MonthName(date, abbreviate) Timer […]