Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: formula placement Post Reply Post New Topic
Author Message
kimt
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Online Status: Offline
Posts: 39
Quote kimt Replybullet Topic: formula placement
     Posted: 21 Dec 2010 at 3:35am
Using VS2008 and cr2008. Have a two column report with a record counter like: whileprintingrecords; numbervar cnt := cnt +1 in the details section. In the report footer is: whileprintingrecords; numbervar cnt ;totext(cnt,0,"").

The numbervar cnt ;totext always prints in the left column. It would be better to print at the end of the report. So if the last record in the report is in the left column, it should print there. However, if the last record is in the right column it should print at the end of that column.

Is it possible? Any help would be great.

Thank you.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 Dec 2010 at 4:09am
sure, just a matter of writing your formula to display
 
since there must be some logic to displaying the records (left vs right column) use that to display or hide the column
 
Since it is printing as text, life is that much easier.  Something this works:
numbervar cnt;
if (logic to display) then
  totext(cnt, 0, "")
else
 ""
 
HTH
IP IP Logged
kimt
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Online Status: Offline
Posts: 39
Quote kimt Replybullet Posted: 21 Dec 2010 at 8:26am
Thanks for the response. Whenever I exit the edit an error msg says that the ')' is missing and highlights 'logic'. The formula appears to be balanced to me.
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 21 Dec 2010 at 10:08am
The "logic to display" is the formula that determines if the item is printed in the left or right column.  Do you know what that would be ?
IP IP Logged
kimt
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Online Status: Offline
Posts: 39
Quote kimt Replybullet Posted: 21 Dec 2010 at 10:45am
Thanks for the response. It is a db field called name. Replacing (logic to display) with (name). Same error. The ) is missing.
IP IP Logged
kimt
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Online Status: Offline
Posts: 39
Quote kimt Replybullet Posted: 22 Dec 2010 at 3:36am
This:
whileprintingrecords; numbervar cnt;
if (numbervar cnt>41) then  totext(cnt,0,"")
else
"" ;

does the same as the original. There is no changing of where the number is printed.

whileprintingrecords; numbervar cnt  ;totext(cnt,0,"");

Any other ideas? Thanks.
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 22 Dec 2010 at 4:59am

I think Lockwelle's original idea was to have 2 formula fields in the report footer.  One formula in the left column and one in the right column.  Each formula would check if the number should be printed in that column.  If so, return the number.  If not, return nothing. 

It looks like you are using CNT as a counter.  The logic for the left column in the report footer would look something like

If (cnt should be printed in the left column) then totext(cnt,0,"") else "".

You will need the corresponding formula for the right column also.  The thing you have to figure out is how to decide if cnt should go in the right column or the left. 

Hope this helps.


Edited by JohnT - 22 Dec 2010 at 5:00am
IP IP Logged
kimt
Newbie
Newbie
Avatar

Joined: 06 Oct 2009
Online Status: Offline
Posts: 39
Quote kimt Replybullet Posted: 22 Dec 2010 at 11:16am
Thanks. The report was made with the label template and therefore only one column shows. The report has two four inch wide columns each 10.5 inches long. What do you suggest for placing the formula? Would seem that there should be a variable to count the number of spaces available, first page because of the header, has seven fewer spaces than succeeding pages.
IP IP Logged
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