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

How to print total of hits from a counter 1

Status
Not open for further replies.

rji1124

Technical User
Nov 15, 2001
67
US
Hi...

We are using CR 9.0 - reporting from Peregrine Service Center P4 Database...

I have a requirement to add a field to a report that shows a count of the number of 'hits' reported from the formula below...

Currently the formula below lists all the SCAutomate updates - we want to tally those.

whileprintingrecords;
stringvar array Sc:= split({probsummarym1.update.action},"SCAutomate ");
stringvar array ScOut;
redim ScOut[ubound(Sc)];
numbervar counter;
For counter := 1 to ubound(Sc) do(
ScOut[Counter] := "SCAutomate " + left(Sc[counter],instr(Sc[counter]," "))
);
join(ScOut,",")

Thanks for any help on this...
 
Try:

whileprintingrecords;
numbervar TotHits;
stringvar array Sc:= split({probsummarym1.update.action},"SCAutomate ");
stringvar array ScOut;
redim ScOut[ubound(Sc)];
numbervar counter;
For counter := 1 to ubound(Sc) do(
ScOut[Counter] := "SCAutomate " + left(Sc[counter],instr(Sc[counter]," "))
);
TotHits:=TotHits+ubound(scout);
join(ScOut,",")

Then you can display the TotHits variable in a later formula.

Or perhaps the hits are the values in sc[counter], in which case you might use:

whileprintingrecords;
numbervar TotHits;
stringvar array Sc:= split({probsummarym1.update.action},"SCAutomate ");
stringvar array ScOut;
redim ScOut[ubound(Sc)];
numbervar counter;
For counter := 1 to ubound(Sc) do(
ScOut[Counter] := "SCAutomate " + left(Sc[counter],instr(Sc[counter]," "));
TotHits:=TotHits+val(left(Sc[counter],instr(Sc[counter]," ")));
);
join(ScOut,",")

Hard to say as you didn't specify what the hit count is, just that there's one in the formula.

-k
 
Thanks for your reply... the output (hits) from my original thread looks like this on the report:

SCAutomate 08/14/06 ,SCAutomate EXTERNALERROR ,SCAutomate EXTERNALERROR ,SCAutomate EXTERNALERROR

Really all I want to see is the number of times SCAutomate appears - in the above case the number 4...

The data is grabbed from a freeform array...

Thanks again
 
And how would I know wher the 4 comes from based on your code?

Anyway, did you try my first formula, or are you waiting for something different?

-k
 
The number 4 comes from the 4 times SCAutomate appears in the captured text example... some tickets may have only one or two entries from SCAutomate.

I did try both of the examples you gave, but I probably did not explain myself well... so I didn't see the tally I wanted.

The current formula I have is in the Format Editor - Commom tab - Display String formula for a field named update.action. This field captures updates to a ticket from users (and an automation tool). I wanted to tally the number of times SCAutomate (the tool) updates the ticket.

In the first formula I tried to show TotHits a couple of different ways but could not get a total - obviously an error on my part somewhere...

Thanks again for all your help.
 
If this formula is in the details:

whileprintingrecords;
numbervar TotHits;
stringvar array Sc:= split({probsummarym1.update.action},"SCAutomate ");
stringvar array ScOut;
redim ScOut[ubound(Sc)];
numbervar counter;
For counter := 1 to ubound(Sc) do(
ScOut[Counter] := "SCAutomate " + left(Sc[counter],instr(Sc[counter]," "))
);
TotHits:=TotHits+ubound(scout);
join(ScOut,",")

And you place this in the group footer:

whileprintingrecords;
numbervar TotHits

you should get the total number of values displayed in the original formula.

Not sure why this formula would be in a format editor of something.

-k
 
I took the formula out of the format editor and put it in Details - added the TotHits to the footer - looks like the results now are a running total (I wanted a total per group)... will work on it some more...
 
Then put the display formula in the group footer and create a reset formula in the group header:

whileprintingrecords;
numbervar TotHits:=0

Note that you never moentioned anything about it being in a group, hopefully this exercise of discovery will allow you to phrase questions in the future to describe the rewquirement in the beginning, the requirements came very piecemeal here.

-k
 
That did it - thanks - you are the best...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top