p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

crystal_reports thread: IF THEN ELSE in Crystal


Message #1 by "Enzo Zaragoza" <enzaux@g...> on Wed, 27 Nov 2002 13:38:38 +0800
Hello!

I'm doing an external report(*.rpt) in CR 8.5 and i'm doing a formula.
What's the correct format for a compound statement in if then else statement?
I have an error in formula in these one:

if {qryPaymentsNBalances.BillingCurrency}="PHP" then
TotPHPAmt := TotPHPAmt + Sum ({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID})
TotPHPBal := TotPHPBal + ({qryPaymentsNBalances.Amount} - Sum ({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}))
else
TotUSDAmt := TotUSDAmt + Sum ({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID});
TotUSDBal := TotUSDBal + ({qryPaymentsNBalances.Amount} - Sum ({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}));


Thanks,


Enzo c",)
YahooID: yackydidakdak






to unsubscribe send a blank email to leave-vb_howto-1578970U@p...



Message #2 by Zulfazli <Zulfazli@l...> on Wed, 27 Nov 2002 13:14:47 +0700
You must construct your statement like this :
If <expTest> then
 ( 
   Statement1;
   Statement2;
    ..;
   StatementN
 )
Else
 ( 
   Statement1;
   Statement2;
    ..;
   StatementN
 );

-----Original Message-----
From: Enzo Zaragoza [mailto:enzaux@g...] 
Sent: Wednesday, November 27, 2002 12:39 PM
To: crystal_reports
Subject: [crystal_reports] IF THEN ELSE in Crystal



Hello!

I'm doing an external report(*.rpt) in CR 8.5 and i'm doing a formula.
What's the correct format for a compound statement in if then else
statement? I have an error in formula in these one:

if {qryPaymentsNBalances.BillingCurrency}="PHP" then
TotPHPAmt := TotPHPAmt + Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID}) TotPHPBal := TotPHPBal +
({qryPaymentsNBalances.Amount} - Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID})) else TotUSDAmt := TotUSDAmt + Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}); TotUSDBal
:= TotUSDBal + ({qryPaymentsNBalances.Amount} - Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}));


Thanks,


Enzo c",)
YahooID: yackydidakdak






to unsubscribe send a blank email to leave-vb_howto-1578970U@p...




Message #3 by Dheeraj Singh <Dheeraj.Singh@b...> on Wed, 27 Nov 2002 08:22:32 +0200
hi

just remove the for loops


this is my code


if {p_product_sales.serial_number}= ' ' then
myoutput:= ""
else
if {p_product_sales.prod_code} = "tc" then 
(
For LoopCounter:= 2 to loopcounter1
Do
 (

    OneLine := Serial[LoopCounter];
    StringVar tmpText1:= Right(oneline, Length(oneline));
    Stringvar MyOutput :=myoutput + tmpText1 + chr(10) ;

 );
    myoutput;      
)
else
   if {p_product_sales.prod_code} = "gv"  then
(
For LoopCounter:=  2 to loopcounter1
Do
 (
    OneLine := Serial[LoopCounter];
    StringVar tmpText1:= Right(OneLine, Length(OneLine) );
   // StringVar tmpText2:= Right(OneLine, Length(OneLine) - InStr(OneLine, "
"));  
    MyOutput := MyOutput + tmpText1 + chr(10);
 );

MyOutput;

)
else
    if {p_product_sales.prod_code} = "gc" or {p_product_sales.prod_code} 
"tk" or {p_product_sales.prod_code} = "wc" 
     then

(
For LoopCounter:=  2 to loopcounter1
Do
 (
    OneLine := Serial[LoopCounter];
    StringVar tmpText1:= Right(OneLine, Length(OneLine));
   // StringVar tmpText2:= Right(OneLine, Length(OneLine) - InStr(OneLine, "
"));  
    MyOutput := MyOutput + tmpText1 + chr(10);
 );

MyOutput;

)
else 
    if {p_product_sales.prod_code} = "dr"  then

(
For LoopCounter:= 2 to loopcounter1
Do
 (
    OneLine := Serial[LoopCounter];
    StringVar tmpText1:= Right(OneLine, Length(OneLine));
   // StringVar tmpText2:= Right(OneLine, Length(OneLine) - InStr(OneLine, "
"));  
    MyOutput := MyOutput + tmpText1 + chr(10);
 );

MyOutput;

)
else
  if {p_product_sales.prod_code} = "tm" and {p_product_sales.status} = "t"
then

(
For LoopCounter:=  1 to loopcounter1
Do
 (
    OneLine := Serial[LoopCounter];
    StringVar tmpText1:= oneline;
    //StringVar tmpText1:= Right(OneLine, Length(OneLine)-15);
   // StringVar tmpText2:= Right(OneLine, Length(OneLine) - InStr(OneLine, "
"));  
    MyOutput := MyOutput + tmpText1 + chr(10);
 );

MyOutput;

)
else
 if {p_product_sales.prod_code} = "tm" and {p_product_sales.status} = "f"
then

(
For LoopCounter:=  2 to loopcounter1
Do
 (
    OneLine := Serial[LoopCounter];

    StringVar tmpText1:= Right(OneLine, Length(OneLine)-15);
   // StringVar tmpText2:= Right(OneLine, Length(OneLine) - InStr(OneLine, "
"));  
    MyOutput := MyOutput + tmpText1 + chr(10);
 );

MyOutput;

)

else
Myoutput:={p_product_sales.serial_number};

-----Original Message-----
From: Enzo Zaragoza [mailto:enzaux@g...]
Sent: Wednesday, November 27, 2002 7:39 AM
To: crystal_reports
Subject: [crystal_reports] IF THEN ELSE in Crystal



Hello!

I'm doing an external report(*.rpt) in CR 8.5 and i'm doing a formula.
What's the correct format for a compound statement in if then else
statement?
I have an error in formula in these one:

if {qryPaymentsNBalances.BillingCurrency}="PHP" then
TotPHPAmt := TotPHPAmt + Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID})
TotPHPBal := TotPHPBal + ({qryPaymentsNBalances.Amount} - Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}))
else
TotUSDAmt := TotUSDAmt + Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID});
TotUSDBal := TotUSDBal + ({qryPaymentsNBalances.Amount} - Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}));


Thanks,


Enzo c",)
YahooID: yackydidakdak






to unsubscribe send a blank email to leave-vb_howto-1578970U@p...




Message #4 by "Enzo Zaragoza" <enzaux@g...> on Wed, 27 Nov 2002 15:02:36 +0800
Thanks Zulf and Deehraj!!!

Thanks,

enzo c",)

-----Original Message-----
From: Zulfazli [mailto:Zulfazli@l...]
Sent: Wednesday, November 27, 2002 2:15 PM
To: crystal_reports
Subject: [crystal_reports] RE: IF THEN ELSE in Crystal


You must construct your statement like this :
If <expTest> then
 ( 
   Statement1;
   Statement2;
    ..;
   StatementN
 )
Else
 ( 
   Statement1;
   Statement2;
    ..;
   StatementN
 );

-----Original Message-----
From: Enzo Zaragoza [mailto:enzaux@g...] 
Sent: Wednesday, November 27, 2002 12:39 PM
To: crystal_reports
Subject: [crystal_reports] IF THEN ELSE in Crystal



Hello!

I'm doing an external report(*.rpt) in CR 8.5 and i'm doing a formula.
What's the correct format for a compound statement in if then else
statement? I have an error in formula in these one:

if {qryPaymentsNBalances.BillingCurrency}="PHP" then
TotPHPAmt := TotPHPAmt + Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID}) TotPHPBal := TotPHPBal +
({qryPaymentsNBalances.Amount} - Sum ({qryPaymentsNBalances.PayAmt},
{qryPaymentsNBalances.AgentID})) else TotUSDAmt := TotUSDAmt + Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}); TotUSDBal
:= TotUSDBal + ({qryPaymentsNBalances.Amount} - Sum
({qryPaymentsNBalances.PayAmt}, {qryPaymentsNBalances.AgentID}));


Thanks,


Enzo c",)
YahooID: yackydidakdak






to unsubscribe send a blank email to leave-vb_howto-1578970U@p...









  Return to Index