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

Summarize a formula with variables

Status
Not open for further replies.

ij76

Technical User
Mar 15, 2005
25
CA
I am trying to get a sum of a formula which contains variables. The formula field does not show up as an option to be able to summarize. When I tried doing it mannualy, I got an error saying the filed can't be summarized. Is there a workaround?
 
You could use the three-formula method. Can't tell whether you are trying to summarize at the group level, but let's assume that you are:

//{@reset} to be placed in the group #1 header:
whileprintingrecords;
numbervar sumformula := 0;

//{@accum} to be placed in the section where your formula is (detail or group #2 header):
whileprintingrecords;
numbervar sumformula := sumformula + {@yourformula};

//{@display} to be placed in the Group #1 footer:
whileprintingrecords;
numbervar sumformula;

For additional help, you should provide your report structure (groups,etc.) and also the content of your {@yourformula}.

-LB
 
The above is giving me a 0.00, let me give you more details of my report (I have just been given a couple of changes anyway).

Group#1 - Client

Group#2 - Severity Level
Can have up to 3 groups for each client; high, medium and low

Group#3 - Incident#
Here I have 2 formulas per incident#, OpenToResponse and OpenToClose:

OpenToResponse (the # of hours between the Open time and the status time) = evaluateafter({@Variables});
tonumber((datetimevar Response-datetimevar Open)*24);

OpenToClose (the # of days between the Open time and the Closed time)= evaluateafter({@Variables});
tonumber(datetimevar Closed-datetimevar Open);

The ultimate goal here is to create a chart for each Client that shows the avg OpenToResponse and OpenToClose for each Severity Level (group#2) as well as the avg OpenToResponse and OpenToClose overall.

I really appreciate any help...I've never been great with these variables, and up until now haven't had to use them much....BTW, not sure if it matters, but I am on version 9
 
You need to explain what you want to sum and also show the contents of {@variables}.

-LB
 
I actually need to avg, not sum. I need to average the OpenToResponse and the OpenToClose for each severity level per client.

My {@variables} formula is (placed in RH):

whileprintingrecords;
datetimevar Open;
datetimevar Response;
datetimevar Closed;
Open:=NthSmallest (1, {Incident_History.ChangeDate}, {Incident_History.IncidentID});
if previous({Incident_History.ChangeDate})=Open then Response:={Incident_History.ChangeDate};
if {Incident_History.Status}="07. Pending Closure" then Closed:={Incident_History.ChangeDate}else
if {Incident_History.Status}="08. Suspended" then Closed:={Incident_History.ChangeDate}else
if {Incident_History.Status}="09. Deferred to Future Release" then Closed:={Incident_History.ChangeDate}else
if {Incident_History.Status}="11. Closed" then Closed:={Incident_History.ChangeDate} else datetimevalue(0,0,0,0,0,0)

I also have a reset formula in the GH#3:

WhilePrintingRecords;
datetimevar Open:=datetime(0,0,0,0,0,0);
datetimevar Response:=datetime(0,0,0,0,0,0);
datetimevar Closed:=datetime(0,0,0,0,0,0);

In the details section I have:

Status StatusDate {@OpenStatus} {@Response} {@Closed}

{@OpenStatus} = evaluateafter({@Variables}); datetimevar Open
{@Response} = evaluateafter({@Variables}); datetimevar Response
{@Closed} = evaluateafter({@Variables}); datetimevar Closed

And this is really my whole report....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top