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

Show Answer in report -running total 1

Status
Not open for further replies.

RobHVB6Sql

Programmer
May 20, 2002
77
0
0
AU
Hmm, a prickly one here. [evil]
I wish to highlight the mimimum of a number field 'AgeAtDiagnosis' in a report.

I have a running total (#RTotal0) and can get the minimum of the number field in the report footer.
(I think a running total was necessary as AgeAtDiagnosis contains 0 values).

I now want to highlight the details row where it occured.
I have a formula 'HighlightAge@Diag' placed in the details row:
Code:
if {@Truncate-Age@Diag} = {@RoundRunTotal} then 
  "***"
I've tried to set @RoundRunTotal to EvaluateAfter but then of course it doesn't hightlight the appropriate row.

How can I access the minimum answer in 'HighlightAge@Diag'

Any ideas? :p

PS 'Truncate-Age@Diag' is also here for reference
Code:
// only show one decimal place

if IsNumeric({spPrintClientByDiagnosis;1.AgeAtDiagnosis}) then
   round (ToNumber({spPrintClientByDiagnosis;1.AgeAtDiagnosis}), 1)
else 
   0

Rob Hasard
(VB6 /SQL 7.0 /CR8.5)
 
You would either have to save the report as a subreport which you then place in the original report's report header, so that the minimum is available for highlighting throughout the report. You would have to set the minimum to a shared variable in the subreport, and then reference it in the main report in the highlighting formula.

A better solution would be to eliminate the running total, and replace it with a conditional formula, if possible.

If you changed your {@Truncateage@diagnosis} formula to something like:


if IsNumeric({spPrintClientByDiagnosis;1.AgeAtDiagnosis}) and {spPrintClientByDiagnosis;1.AgeAtDiagnosis} > 0
then
round (ToNumber({spPrintClientByDiagnosis;1.AgeAtDiagnosis}), 1)
else
99999999

...you could then insert a minimum on the formula which would be available throughout the report.

-LB
 
Awesome :)
I was close.

Yes the solution is:

1) {@Truncate-Age@Diag} formula:
Code:
If IsNumeric({spPrintClientByDiagnosis;1.AgeAtDiagnosis}) and {spPrintClientByDiagnosis;1.AgeAtDiagnosis} > '0'
then
   round (ToNumber({spPrintClientByDiagnosis;1.AgeAtDiagnosis}), 1)
else 
   99999

2) Right click /format field /common tab /Tick Surpress /add this surpress formula.
(To hide the 0 values and disregard then in the min calculation.)
Code:
{@Truncate-Age@Diag} = 99999

3) Formula to place beside {@Truncate-Age@Diag} in the details section {HighlightAge@Diag}:
Code:
if {@Truncate-Age@Diag} = MINIMUM({@Truncate-Age@Diag}) Then
"***"

Now *** will only show next to the minimum age of diagnosis.

Thanks heaps.

Rob Hasard
(VB6 /SQL 7.0 /CR8.5)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top