×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

presenting all records that meet a condition plus the first record only that does not meet the cond

presenting all records that meet a condition plus the first record only that does not meet the cond

(OP)
Hi

I have a report that compare running total with a constant.
I want to present all records where running total is smaller then constant plus (and only) the first record where running total is equal or greater then constant.
tried the following :1. identify first record that meet the condition
WhilePrintingRecords;
numberVar N := 0;
if ({@accum_stoc}>=0 and next({@accum_stoc} )>=0 and Previous ({@accum_stoc} )<0 ) then N:={VU_QNTY_RUNNING_TTALS.DOC_NBR};
N;
then suppress records where recordNumber<= N+1;

However i am getting only n record # 141 in the example
and it does not work when part changes.

record
Number Rtotal const @accum_stoc part
140 24545 26650 2105 XXX
141 24571 26650 2079 XXX
142 29571 26650 -2921 XXX
143 450 2135 YYY

thanks

RE: presenting all records that meet a condition plus the first record only that does not meet the cond

Your post is confusing since you say you want to show all records up to and including the first one where the constant minus the accumulated stock is less than (<) 0, but then you show a formula that would suppress records that are less than N+1. I'm assuming you really meant to suppress records greater than (>) N+1.

I'm also unclear on whether you want to show records for parts where the accumulated stock does not exceed the constant. Please clarify.

Anyway, try this:

First you should have a group on part, even if you don't want to show the group header/footer, so that you can add a reset formula to the group footer. Create three formulas:

//{@threshold record} to be placed the in the detail section:
whileprintingrecords;
numbervar cnt;
numbervar amt;
numbervar prev := amt;
amt := amt + {table.stockamount});
if {table.constant}-amt <=0 then
cnt := cnt + 1;

//{@diff} for display in detail section:
evaluateafter ({@threshold record});
numbervar amt;
{table.constant}-amt;

//{@totalstock} for display of accumulated stock in detail section:
whileprintingrecords;
numbervar amt;

//{@reset} to be placed in part group footer:
whileprintingrecords;
numbervar amt := 0;
numbervar cnt := 0;

-LB

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!