Loading

SAP Crytal Report

How to Creating Arrays in Crystal Reports?. The Complete SAP Crytal Report Developer Course 2023 [Videos].

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

See All

Comments (363 Comments)

Submit Your Comment

See All Posts

Related Posts

SAP Crytal Report / Blog

What is Crystal Reports ?

SAP Crystal Reports is a Business Intelligence tool which is used to generate reports from both SAP and non-SAP data sources. It enables end users to generate reports that includes exceptional visualizations and implement new business requirements into reports to reduce dependency on IT and Report developers.
7-Feb-2022 /17 /363

SAP Crytal Report / Blog

What is GUI Navigation in Crystal Reports?

Crystal Reports for enterprise provides an interface that enables you to quickly and easily create, format, and publish effective reports. The menu bar provides full range of features available in Crystal Reports for Enterprise as shown in the following image.
7-Feb-2022 /17 /363

SAP Crytal Report / Blog

What is Options in Crystal Reports?

Report Options is one of the most commonly used feature in Crystal Report Designer, when you need to access/modify the values of Report Options of a Crystal report at runtime in a Crystal Reports .NET application.
7-Feb-2022 /17 /363