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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Charting Print Time formula Values

Status
Not open for further replies.

Ayush15690

Programmer
May 2, 2013
7
Hi,
I am using Crystal Reports XI and I am trying to chart this formula,but crystal report throws an error that I can't chart print time values .
shared numberVar x ;
shared numberVar y ;
shared numberVar z ;
shared numberVar t;
shared numberVar u ;

If {Command.weekno} =1 then
x :=Sum({Command.duration},{Command.weekno})/1
else if {Command.weekno} = 2 then
y :=(x+Sum({Command.duration},{Command.weekno}))/2
else if {Command.weekno} = 3 then
z :=(y*2 +Sum({Command.duration},{Command.weekno}))/3
else if {Command.weekno} =4 then
t :=(z*3 + Sum({Command.duration},{Command.weekno}))/4
else if {Command.weekno} = 5 then
u :=(t*4 +Sum({Command.duration},{Command.weekno}))/5

I want to plot above values on line graph against WEEK NUMBER(A month has 5 weeks). I tried every possible method given. I used the sub report also but it didn't seem to be working. When I try using a formula to split the array of the values of above formula in sub report indexed by RECORD NUMBER it throws an error :-The index should be between 1 and Size of array. Please help as I have a deadline to meet.
 
Why are you using printtime variables why not create 5 formula

@x
If {Command.weekno} =1 then Sum({Command.duration},{Command.weekno})/1

@y
if {Command.weekno} = 2 then
(@x+Sum({Command.duration},{Command.weekno}))/2

etc

You might find it easier to chart these

Ian
 
I tried your method it gives an error :- The rest of the text doesn't appear to be a part of formula.
Can you post the exact code for formula?
 
I tried Five different formulas but it gives me wrong values for rest of the conditions.Please suggest.
 
Hi Ian,
Let me tell you why I am getting wrong values for the formulas if I create five different formulas.
See the first formula will give me result corresponding to week 1 one ,but the moment i use this formula value in the second formula which is supposed to generate value corresponding to Week 2 ,the previous formula instead of giving its original value ,which is corresponding to week 1 ,will give out value corresponding week 2 ,which is nothing but zero.Therefore, wrong results will be populated for all the following formulae. This happens when I put all the formulae in Details section of crystal reports.

if I put all the formulae in Header section of the report,then apart from formula one rest will give out zero values,because others wont have any value corresponding to Week 1.

PS:- I have used the Weekno field as the group field in summary function.

So Please help me out with this. It is imperative that I should be able to plot these values on a graph,as it required for further analysis.
I have already tried method described in charting print time value PDF. it didn't work out for me ,so please help.
 
You will need to hold the values in variables for each week

Something like

@x
whileprintingrecords;

global numbervar x;

If {Command.weekno} =1 then x:=Sum({Command.duration},{Command.weekno})/1

Ian
 
Hi,
I tried what you said but I am still unable to plot these 5 different formulas.
These formula don't show up in data section when I open chart expert.
 
Sorry

Should read earlier postings !

Looks like you will need to build a command and group the data by week in SQL and then report off that data.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top