Crystal Reports  

«Å§i°}¦CÅÜ¼Æ (Crystal »yªk)

±z¥i¥H¦b«¬§O¦WºÙ«á­±±µµÛ¥ÎÃöÁä¦r Array¡A¨Ó«Å§i°}¦CÅܼơC

½d¨Ò

//Declare x to be a Global variable of
//Number Array type
Global NumberVar Array x := [10 , 20, 30];
//cost is a Global variable of Currency Array type
//It is automatically Global since the scope specifier
//(one of Local, Global or Shared) is omitted.
CurrencyVar Array cost := [$19.95, $79.50, $110.00,
                           $44.79, $223.99];
//payDays is a Global variable of Date Array type
Global DateVar Array payDays := [CDate(1999, 5, 15),
CDate(1999, 5, 31)];
//y is a Shared variable of String Range Array type
Shared StringVar Range Array y := ["A" To "C",
"H" To "J"};
//days is a Local variable of String Array type
Local StringVar Array days;
days := ["Sun", "Mon", "Tue", "Wed", "Th",
"Fri", "Sat"};

«ü¬£¼Æ­Èµ¹°}¦Cªº¤¸¯À

±z¥i¥H«ü¬£°}¦C¤¸¯Àªº­È¡A¤]¥i¥H¥Î³o¨Ç­È¨Ó¶i¦æ¨ä¥L­pºâ¡C

½d¨Ò

StringVar Array x := ["hello", "bye", "again"];
x [2] := "once"; //Now x is ["hello", "once", "again"]
//The expression below would cause an error if not
//commented out since the array has size 3
//x [4] := "zap";
//The formula returns the String "HELLO"
UpperCase (x [1])

¦pªG±z·Q­n¦b°}¦C¤¤¥[¤J§ó¦hªº¸ê°T¡A¥i¥H¨Ï¥Î Redim ©M Redim Preserve ÃöÁä¦r¨Ó½Õ¾ã°}¦Cªº¤j¤p¡CRedim ·|¦b½Õ¾ã°}¦Cªº¤j¤p¤§«e¡A¥ý²M°£°}¦C¤¤­ì¨Óªº¤º®e¡A¦Ó Redim Preserve «h·|«O¦s­ì¨Óªº¤º®e¡C

Local NumberVar Array x;
Redim x [2]; //Now x is [0, 0]
x [2] := 20; // Now x is [0, 20]
Redim x [3]; // Now x is [0, 0, 0]
x [3] := 30; // Now x is [0, 0, 30]
Redim Preserve x [4]; // Now x is [0, 0, 30, 0]
"finished"
Local StringVar Array a;
Redim a [2];
//Assign a value to the first element of array a
a[1] := "good";
a[2] := "bye";
//The & operator can be used to concatenate strings
a[1] & a[2] //The formula returns the String "goodbye"

°}¦C©M For °j°é

°}¦C¸g±`©M For °j°é¤@°_¨Ï¥Î¡C¥H¤Uªº½d¨Ò±N§Q¥Î For °j°é¨Ó«Ø¥ß¤Î¨Ï¥Î°}¦C [10, 20, 30, ..., 100]¡C

Local NumberVar Array b;
Redim b[10];
Local NumberVar i;
For i := 1 To 10 Do
(
b[i] := 10 * i
);
b [2] //The formula returns the Number 20

½Ð°Ñ¾\

For °j°é