Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Bolding a field based on subreport value?? Post Reply Post New Topic
Page  of 2 Next >>
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: Bolding a field based on subreport value??
    Posted: 04 Mar 2013 at 9:30am
Hi,

Is there a way I can bold a field on a main report based on the value of a subreport

What I want to do is bold name if field1, field2 or field3 have a value in them in the subreport

Thanks
In Advance
Joe

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 10:12am
if the subreport is run before (in a section above) the field you want to bold and you return the value or some flag based on all of the values as a chared variabl then you can use the shared variable in the main report as your condition for bolding
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 04 Mar 2013 at 10:15am
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 04 Mar 2013 at 10:20am
thanks for getting back

the sub is display in the detal section
I created this formula in the subreport
whileprintingrecords;
shared numbervar totals:=Sum ({@Monday}, {@client})+Sum ({@Tuesday}, {@client})+Sum ({@Wednesday}, {@client})+Sum ({@Thursday}, {@client})+Sum ({@Friday}, {@client})

which gives me the correct total

and I have this formula in the main report
WHILEPRINTINGRECORDS;
SHARED NUMBERVAR TOTalS;
TOTalS

then i conditionally format the field

// This conditional formatting formula must return one of the following Font Style Constants:
//
// crRegular
// crBold
// crItalic
// crBoldItalic
//
if {@PASSED}<> 0  then crBold


which all seems to work EXCEPT
if first name is a total of 22 and the next is 0 the passed value still has 22

how do I reset?

Thanks
Joe

IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 04 Mar 2013 at 10:25am
It is calulating corectling on the sub but not passing to the main corectly

I must have the sections messed up?


Edited by jbalbo - 04 Mar 2013 at 10:26am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 10:29am

if sub report is in detail a then the shared variable in main report has to be in detail b (or a footer) to work

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 10:39am
also the bolded field has to be on detail b (or below).
also you cannot suppress the subreport. Suppressed sub reports do not run.
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 04 Mar 2013 at 10:41am
sorry I'm really screwing this up!!!!

It seems that I have things in the wrong place
Subreport
 I have the formula that passes the sums to the mainreport in GF1
I display data in GF2 (The sub does not display detail section)

Mainreport
I have the formula in detailsb and the data in detailsa

I get this

Client 1 - has total of 29(in sub) but passes 0 to main
client 2 - has total of 23 but passes 29
client 3 has total of 0  but passes 23
etc.....

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 10:49am

move the sub report to the GH1a. You can technically hide it if you want to as there is a trick for that but for now just get it to work then worry about suppressing.

Place the shared variable formula in the main report on GH1b. This also can be suppressed but make sure it gives you the correct value before hiding it.
now your bolded field should be details A and it should work 'correctly'. You dont need a Details B anymore (I think).
 
Basically just rememember this flows from top to bottom always. You can never reverse the flow of it. So your flow right now has the bolding condition looking at the value form the last group because the variable is being set up in the GF.


Edited by DBlank - 04 Mar 2013 at 10:52am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 10:50am
If you need to display values in the group footer you can pass other shared variables from the GH sub report and use them to display in the GF or you could insert another version of the subreport into the GF (much less efficient).
IP IP Logged
Page  of 2 Next >>
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.000 seconds.