Crystal Reports  

Grouping ¹Bºâ¦¡ (Crystal »yªk)

If ¹Bºâ¦¡¤]¬O ¤@­Ó¹Bºâ¦¡¡A¤]´N¬O»¡¡A¥¦·|Åçºâ«ü©w«¬§O­È¡C°²¦p¨S¦³ Else ¤l¥y¡A¦Ó¥B±ø¥ó¬° False ®É¡A«h¹Bºâ¦¡ªº­È´N¬O¸Ó«¬§Oªº¹w³]­È¡C¨Ò¦p¡G

If Length ({­û¤u.¦W¦r}) < 5 Then
"²µu"

¥H¤Wªº If ¹Bºâ¦¡·|¶Ç¦^¦r¦ê­È¡C¦pªG­û¤uªº¦W¦r¤Ö©ó¤­­Ó­^¤å¦r¥À¡A¶Ç¦^ªº¦r¦ê­È¬° "²µu"¡F¦pªG­û¤uªº¦W¦r¶W¹L¤­­Ó­^¤å¦r¥À¡A«h¶Ç¦^ªÅ¥Õ¦r¦ê ""¡C

½Ð·Q¤@·Q¤U­±³o­Ó¤½¦¡¡G

If Year({­q³f¥DÀÉ.­q³f¤é´Á}) >= 1995 Then
{­q³f¥DÀÉ.­q³f¤é´Á}

¦pªG­q³f¤é´Á¦­©ó 1995 ¦~¡A¥H¤Wªº If ¹Bºâ¦¡·|¶Ç¦^ Null ¤é´Á®É¶¡­È¡C¥Ñ©ó {Orders.Order Date} ¬O¤é´Á®É¶¡¸ê®Æ®wÄæ¦ì¡A¦]¦¹¨ä­È¬O¤é´Á®É¶¡­È¡A¦Ó¤£¬O¤é´Á­È¡CCrystal Reports ¤£·|¦C¦L Null ¤é´Á®É¶¡­È¡A¦]¦¹¡A¦pªG±N¥H¤W¤½¦¡©ñ¦b³øªí¤¤¡A1995 ¦~¤§«e­q³f¤é´Áªº¤½¦¡Äæ¦ì´N·|¬OªÅ¥Õªº¡CNull ®É¶¡­È©M Null ¤é´Á­Èªº³B²z¤è¦¡Ãþ¦ü¡C

¤U­±³o­Ó½d¨Ò±N»¡©ú¦p¦ó¨Ï¥Î¬A¸¹¡A°õ¦æ¤@­Ó¥H¤Wªº¹Bºâ¦¡¡A·í°µ If ±ø¥óªºµ²ªG¡C¬Y¤½¥q¹ï¤T¤Ñ¤§¤º°e¨ìªº­q³æ¦¬¨ú 5% ªº¶O¥Î¡A¨ä¥Lªº«h¦¬¨ú 2%¡C¸Ó¤½¥q§Æ±æ¨Ì·Ó±¡ªp¦C¦L¥X¡u«æ¥ó¥X³f $100.00¡v©Î¡u¤@¯ë¥X³f $20.00¡vµ¥¾A·í°T®§¡C

Local StringVar message;
Local CurrencyVar ship;
If {­q³f¥DÀÉ.°e³f¤é´Á} - {­q³f¥DÀÉ.­q³f¤é´Á} <= 3 Then
(
message := "«æ¥ó";
//A semicolon at the end of the next line
//is optional
ship := {­q³f¥DÀÉ.­q³fª÷ÃB} * 0.05
} //A semicolon cannot be placed here
Else
(
message := "´¶³q";
ship := {­q³f¥DÀÉ.­q³fª÷ÃB} * 0.02;
);
//The preceding semicolon is required to seperate the
//If expression from the final expression below
message & "¥X³f" & CStr (ship)

·í±z¥Î¬A¸¹±N¹Bºâ¦¡²Õ¦¨¸s²Õ®É¡A·|±N¾ã­Ó¸s²Õµø¬°³æ¤@¹Bºâ¦¡¡A¦Ó¥¦ªº­È¤Î«¬§O«K¬O¬A¸¹¤¤³Ì«á¤@­Ó¹Bºâ¦¡ªº­È¤Î«¬§O¡C

//The parentheses group expression as a whole has
//Currency type
(
//The first expression in the parentheses has
//String type
message := "«æ¥ó";
//The second and final expression in parentheses
//has Currency type
   ship := {Orders.Order Amount} * 0.05;
)

¨Ò¦p¡A¤U¦C¤½¦¡·|²£¥Í¿ù»~¡A­ì¦]¬O If ¹Bºâ¦¡¤¤ªº Then ³¡¤À·|¶Ç¦^³f¹ô­È¡A¦Ó Else ³¡¤À«h·|¶Ç¦^¦r¦ê­È¡C³o¬O¤£³Q¤¹³\ªº¡A¦]¬° If ¹Bºâ¦¡¥»¨­¬O¤@­Ó¹Bºâ¦¡¡A¦]¦¹¶Ç¦^ªº­È¥²¶·¬O¦P¤@ºØ«¬§O¡C

//An erroneous formula
Local StringVar message;
Local CurrencyVar ship;
If {­q³f¥DÀÉ.°e³f¤é´Á} - {­q³f¥DÀÉ.­q³f¤é´Á} <= 3 Then
(
message := "«æ¥ó";
ship := {­q³f¥DÀÉ.­q³fª÷ÃB} * 0.05
)
Else
(
//The following 2 lines were interchanged
ship := {­q³f¥DÀÉ.­q³fª÷ÃB} * 0.02;
message := "´¶³q";
);
message & "¥X³f" & CStr (ship)

¦³¤@­Ó¤èªk¤£¥Î²z·|¹Bºâ¦¡ªº¶¶§Ç´N¥i¥H­×¥¿³o­Ó¿ù»~ªº¤½¦¡¡A´N¬OÅý If ¹Bºâ¦¡ªº¨C¤@­Ó¤À¤ä³£¶Ç¦^¬Û¦P«¬§Oªº±`¼Æ­È¡C¨Ò¦p¡AIf ¹Bºâ¦¡²{¦b·|¶Ç¦^¼Æ­È 0¡G

//Repaired the erroneous formula
Local StringVar message;
Local CurrencyVar ship;
If {­q³f¥DÀÉ.°e³f¤é´Á} - {­q³f¥DÀÉ.­q³f¤é´Á} <= 3 Then
(
message := "«æ¥ó";
   ship := {Orders.Order Amount} * 0.05;
   0
)
Else
(
ship := {­q³f¥DÀÉ.­q³fª÷ÃB} * 0.02;
message := "´¶³q";
   0
);
message & "¥X³f" & CStr (ship)

½Ð°Ñ¾\

If ¹Bºâ¦¡ | Select ¹Bºâ¦¡