Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting a dollar sign on first row when grp contains subgrps

Status
Not open for further replies.

potatohhead

Programmer
Oct 25, 2006
5
US
I want to print a dollar sign on the first row of each page. I thought the option "One Symbol Per Page" was perfect, but my groups have subgroups and "One Symbol Per Page" gives all the subgroups dollar signs as well.

ONE SYMBOL PER PAGE
Grp A1 $2
A2 $5
Grp B1 4
B2 6

DESIRED RESULT
Grp A1 $2
A2 5
Grp B1 4
B2 6

 
Create a formula of:

if count({table.subgroupfield},groupfield}) > 0
then
"$"
else
""

Place that in the group header, and right click the group and select change group->Options->Repeate group header on each page.

Now palce the formula in the group header, or you can right click the group header and select insert xsection below and palce the formula in there and format the new section to suppress blank section.

-k
 
I tried the formula but it doesn't work. I don't truly understand it as I'm new to Crystal, and might have worded my situation incorrectly.

My report has groups and several sections under each group (the sections contain different calculations). The groups aren't kept together so the first row on a new page could be any section in the group.

 
I think you would have to set up two formulas:

//{@reset} to be placed in the page header:
whileprintingrecords;
numbervar cnt := 0;

//{@cnt} to be placed in the group header that should show the $ sign once per page:
whileprintingrecords;
numbervar cnt := cnt + 1;
if cnt = 1 then
"$" + sum({table.amt},{table.groupfield}) else
sum({table.amt},{table.groupfield});

This assumes that your group summary is the sum of some amount field per group.

-LB
 
It seems that cnt only increments once per group so all the sections under a group have the same cnt. cnt also increments for suppressed groups, which could be a problem if it misses displaying a dollar sign on a page.
 
You should only place the cnt (second) formula in the group header that you want to display the $ sign--not in other sections. If you have a suppression formula that you are using on this group, then you have to build the criteria into the formula, so please share what your suppression criteria are.

-LB
 
My groups aren't kept together because there are so many sections underneath it. All the sections are dollar amounts so if a section happens to be the first row on the page, I want it to display a dollar sign.
 
Okay, then you must place the second formula in all displayed sections and adjust it so it only displays the $ or not, but note that the formula has to include the opposite of your suppression criteria and you didn't supply the requested info. The formula would be something like:

//{@cnt} to be placed in all displayed group and detail sections:
whileprintingrecords;
numbervar cnt;
if not(
<your suppression criteria>
) then
cnt := cnt + 1;
if cnt = 1 then "$"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top