Announcements
 Crystal Reports Forum : General Information : Announcements
Message Icon Topic: formulas in crystal report Post Reply Post New Topic
Author Message
karthi84
Newbie
Newbie


Joined: 29 Jun 2007
Online Status: Offline
Posts: 1
Quote karthi84 Replybullet Topic: formulas in crystal report
    Posted: 29 Jun 2007 at 6:24am
hi i am new to crystal report. can any one help me in using the formula tool in crystal report which is shipped with VS 2005. Can any one help me with a sample. for basic totaling operation in it
sk
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 29 Jun 2007 at 8:12am
The formula tool is pretty straight forward.
 
To  add you can use something like this
 
Create a new formula, give it a name,
then  in the place provided..
type something like this. You can also drag and drop report fields.
 
({field1}+f{field2}+{field3}) and so on...
 
 
another form may be
 
numbervar x;
x := ({field1}+f{field2}+{field3});  
x;
 
The last form uses a variable to hold the result of the addition and then returns the result (x) to be displayed. A couple of things to keep in mind in using forumulas the ':=' assigns a value while a straight '=' is a comparison. This is useful in creating more complicatied calculations. Also the semi colon ';' if not properly placed can create a little havoc. It represent the end of action.  In the second example is does the addition then says stop. Anything that follows is not related to the sum amount being assigned to 'x'
 
Brian has chapter of his book available here and believe there is one on formulas. If this is correct give it a look because it will cover this matter in  far more detail and even better it has pictures.
 
Regards,
 
John W.
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 29 Jun 2007 at 8:16am
Just noticed I had a typo after I posted the reply
 
The error is in the line
{field1}+f{field2}+{field3});  
 
It should be
{field1}+{field2}+{field3});  
 
I just dont know how that extra 'f' got in there.
 
My apologies.
 
John W.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.