Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Q: How to mark a minimum value as the min

edited March 2004 in General
Hi and thank you for enlightening me. D7 RB Ent 7.03

I have a list of values in my detail. Calculating the minimum is easy. What
I want is to mark the min by an asterisk:

5
3 (*)
6
7
2

I tried several things, but failed. Ayn idea?

Thank you!

Bernd

Comments

  • edited March 2004
    Besides the fact, that 2 is the real minimum....

    Bernd

    What
  • edited March 2004
    Well, I think the easiest way will be to use a string typed variable. Place
    it near your values and use OnCalc event;

    if = then
    ppVariable1.Value := '*'
    else
    ppVariable1.Value := '';

    Good luck,
    Sean

  • edited March 2004
    Hi Sean,

    thank you for assistance. The problem is, that the MIN-Value is available
    AFTER the report has finished. So when the value to be marked is printed,
    the MIN value is not known yet.

    And even with look ahead and two pass reports, I was not able to get this to
    work. I placed a variable next to my value, set it to look ahead and the
    report to two pass, and tried to compare in the on calc event:

    if = then
    ppVariable1.Value := '*'
    else
    ppVariable1.Value := '';

    But this does not work. According to the docs, look ahead is for headers and
    titles to compare footer?s calculations, so it seems as if look ahead is not
    suitable for details.

    Any idea?

    Bernd

    What I can do, is placing a variable next to my values and
  • edited March 2004
    > Hi Sean,

    YW. Then you will need an oracle :) or a two pass report. Use OnStartFirstPass
    and OnEndFirstPass events to determine the lowest value and on the second pass
    place sign near it as suggested before.


    Why not? Two pass reports should be the solution.


    To summarise; use first pass to get the lowest value, use second pass to mark
    it. If this fails:
    1. You may need to print twice (first one to the screen of course),
    2. Better you should try to find a way to detect lowest value before printing.

    HTW
    Sean
  • edited March 2004
    Well, Sean, i am not asking the easy questions :-)

    this to

    I think, the timing is the problem. I get the MIN-Value correctly, but the
    comparison in the second pass copmpares to the wrong values.

    I?ll try to make a sample program.

    Bernd
  • edited March 2004
    I just reproduced this with one of the demo reports.

    1) Place a variable in the footer and calc it by
    ... if value < var then value:=var ...
    Gives you the minimum of the details
    2) Add a look ahead var, placed in the detail and compare it to the details
    value. If equal, set the caption else reset
    3) Set the report to two pass

    If you run the report, the caption is not set or set at the wrong records.

    Cheers
    Bernd

  • edited March 2004
    Bernd, I have built a small app and reproduced your problem. If I am able to
    understand you correctly, you use a ppVariable at the footer to hold the min
    value. And you can see the lowest value in the footer but cannot mark it
    correctly in the detail. If so, it is probable cause is ppVariables reseting
    after the first pass.

    First of all set footer ppVariable's timing to Report Start (right click on it
    -> Timing...)

    Do *not* look ahead detail ppVariable.

    OnEndFirstPass event store it's value within another variable (let's name it
    varMin). This should be before resetting occurs.

    On the second pass compare your values with varMin.

    This method worked fine for my small app. Pls do not hesitate to tell me if I
    misunderstand you.

    Good luck
    Sean


  • edited March 2004
    I see. This is something I havn?t tried yet.
    Additionally DM?s support sent me a working samp,e in the meantime.

    Many thanks for your assistance!

    Bernd

This discussion has been closed.