
- Crystal Reports Tutorial
- Crystal Reports - Home
- Crystal Reports - Overview
- Crystal Reports - GUI Navigation
- Crystal Reports - Options
- Crystal Reports - Page Layout
- Crystal Reports - Getting Help
- Crystal Reports - Design Environment
- Crystal Reports - Data Sources
- Crystal Reports - Queries
- Query Filters & Filter Conditions
- Crystal Reports - Time Based Filters
- Field Objects Controls & Modifications
- Crystal Reports - Sections
- Crystal Reports - Delete Sections
- Crystal Reports - Groups
- Crystal Reports - Group Options
- Crystal Reports - Templates
- Crystal Reports - Inserting Objects
- Crystal Reports - Charts
- Crystal Reports - Cross Tab Layout
- Crystal Reports - Defining Formulas
- Crystal Reports - Formula Workshop
- Creating & Modifying Formulas
- Crystal Reports - Apply Boolean Formulas
- Crystal Reports - If-Then-Else
- Crystal Reports - Applying Calculations
- Crystal Reports - Conditional Formatting
- Crystal Reports - Creating Variables
- Crystal Reports - Creating Arrays
- Crystal Reports - Parameters
- Crystal Reports - Filters
- Crystal Reports - Prompt Panels
- Crystal Reports - Cascading Prompts
- Crystal Reports - Create Parameter Field
- Crystal Reports - Edit Parameter Field
- Crystal Subreports - Overview
- Crystal Reports - Data Export Overview
- Crystal Reports - Data Export to Excel
- Crystal Reports - Data Export to XML
- Crystal Reports - Data Export to HTML
- Crystal Reports - Data Export to CSV
- Crystal Reports Useful Resources
- Crystal Reports - Quick Guide
- Crystal Reports - Useful Resources
- Crystal Reports - Discussion
Crystal Reports - Creating Arrays
An Array variable in Crystal Report can be defined by using a keyword “Array”.
Global NumberVar Array Z := [1, 2, 3];
You can also assign values to the elements of Array and these values can be used for computations in formulas. For example −
StringVar Array Z := [“Hello”,”World”]; Z[2] :=[“Bye”]; UpperCase (Z [2] )
This formula will return the string “Bye”.
You can also resize Array using Redim and Redim Preserve keywords. Redim is used to remove previous entries of an Array while resizing it, and Redim Preserve is used to contain previous Array values. For example −
Local NumberVar Array Z; Redim Z [2]; //Now Z is [0, 0] Z [2] := 10; //Now Z is [0, 10] Redim Z [3]; //Now Z is [0, 0, 0], Redim has erased previous Array values. Z [3] := 20; //Now Z is [0, 0, 20] Redim Preserve Z [4]; //Now Z is [0, 0, 20, 0], Redim Preserve has contained previous Array values. "finished"
Array with Loops
Arrays are also used with Loops: like For loop.
Local NumberVar Array Z; Redim Z[10]; Local NumberVar x; For x := 1 To 10 Do (Z[x] := 10 * x); Z [5] //The formula returns the Number 50
Advertisements