Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using a passed value in a Running total? Post Reply Post New Topic
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: Using a passed value in a Running total?
     Posted: 06 Feb 2013 at 9:07am
Hi

I have a value passed from a subreport to the main report but I then want to use that value in a running total forumala, but it isn't in the list to use?

Thanks

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2013 at 10:04am
I think the sub report return happens in a data pass that occurs after the running total pass. You should be able to use it in a shared variable formula
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 06 Feb 2013 at 10:15am
when i go to use it in a formula in a running total it is not an option.
If I try to use a formula to evaluate it then use that formula in a running total it again drops it off the list of choices in the formual in the running total

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2013 at 10:26am

not an evaluate formual but a shared variable formula. SOme peopel call the 'manual Running Totals'

you need 3 formulas.
one to set the value to 0
one to sum or count
and the third to display the final result
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 06 Feb 2013 at 12:01pm
sorry im a bit lost..

So I am looking at clients sorted by client and service date for a month

I need a subreport which goes and checks if an event happened on that service date on the main report if it does it moves a 'Yes' to the main report

I have running totals for each day   DatePart ("d",{RECORDED_SERVICE.STARTTIME}) =1
then move an X to it  I want to add "and "sharedvar(passed from subreport) = 'yes' soit will leave it blank if sharedvar is not YES right now it shows all service dates that happened

Thanks Again




IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Feb 2013 at 12:13pm
is there a reason you have to use a sub report? I hate sub reports especially if you are having to run it for every detail row.
Why not join the service data into the main report?
Assuming you are stuck with the sub report, can you explain al little more?
I can't 'see' what your dat aset up is nor what your trying to get at so I am not sure how to direct you to a solution Confused
 
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 07 Feb 2013 at 3:06am
actually im going to try combining them in one today...

keep tuned in!!  :)

IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 07 Feb 2013 at 4:29am
Hi

So I combined into 1 and still cant add the formula to the running to here is what i have:

Group1 is Client name
Group2 is service date

I but this formula in the G2 Header
WhilePrintingRecords;
NumberVar sum:=0;
sum := 0

I put this in Detail:
WhilePrintingRecords;
NumberVar sum;

sum := sum + if(cdate({RECORDED_SERVICE.STARTTIME}) in cdate({CLIENT_TREATMENT_HISTORY.ADMITDATE}) to cdate({@CHDischargeDAte})) then 1

I put this in GF2 :
WhilePrintingRecords;

NumberVar sum;

I think I have the order messed up?

The ultimate goal is
on GF2 (service date) I haveOne running total for each day of the month)  I look at the day of the month in the running total if "sum " = 0 then  I move an "X" to it if it is greater than 0 then I want blank
 
Then on GF1 (Client I display all 31 running total and it should have an X for each day that had a sum of zero

Thanks




IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Feb 2013 at 11:54am
how about
create a formula field to get just the date from the service
@date_only
cdate({RECORDED_SERVICE.STARTTIME})
 
Set group 2 to be per date per month
now create a running total
name=whatever
type=distinctcount
evaluate=use a formula
cdate({RECORDED_SERVICE.STARTTIME}) in cdate({CLIENT_TREATMENT_HISTORY.ADMITDATE}) to cdate({@CHDischargeDAte})
reset=group 2
place ni group footer 2
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