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

Duplicate Record or End of record

Status
Not open for further replies.

badword

Technical User
Aug 12, 2008
9
US
I have the following formula created

if ((onLastRecord) or Next({data.acctnum}) <>
({data.acctnum})) Then 'STOP' Else ' '

Which puts the the word "STOP" at the end of account number line.

an example of how this works is:
12345
12345
12345
12345
12345 STOP (stop tag is @ the end of the duplicate line)
123456 STOP

What I am trying to accomplish now is to set the STOP tag at the 4th occurrence.

so that if i have a list of the following accounts, the stop tag will be at the 4th occurrence:
12345
12345
12345
12345 STOP
12345
12345 STOP
123456 STOP
 

If the formula is on detail section, and there are no groups, you could try this:

if ((onLastRecord) or Next({data.acctnum}) <>
({data.acctnum})) or remainder(recordnumber, 4) = 0 Then 'STOP' Else ' '

If you have groups, you can use a running total to count the records.

Dana
 
whileprintingrecords;
numbervar cnt := cnt + 1;
stringvar stop;
if cnt = 4 then
stop := "STOP" else
stop := "";
if onLastRecord or
{data.acctnum} <> Next({data.acctnum}) then (
cnt := 0;
stop := "STOP"
);
stop

This assumes you wanted ONLY on the 4th occurrence, not on every 4th record, or based on the other criteria.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top