Print Page | Close Window

formulas in crystal report

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Announcements
Forum Discription: Please check this section for the latest announcements from Crystal Reports Forum
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=943
Printed Date: 28 Apr 2024 at 10:54pm


Topic: formulas in crystal report
Posted By: karthi84
Subject: formulas in crystal report
Date 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



Replies:
Posted By: jkwrpc
Date 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.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: jkwrpc
Date 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.
http://www.CustomReportWriters.net - www.CustomReportWriters.net



Print Page | Close Window