Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7250 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am having a problem with the following script. I only want the first occurance of duplicate records to print.

Show All Records

Sort Records [invfile::PartNO]Restore/No Dialog

GoTo Record/Request/Page [first]

Set Field [invfile::DupCalc(Global); invfile::PartNo

Loop

Go To REcord/Request/Page [Next, Exit after last]

Set Field [invfile::DupCalc; invfile::PartNo]

If [invfile::partno=invfile::Dupcalc]

Omit REcord

End if

End Loop

Posted

Add an Exit Loop statement inside the conditional If-End If statements...because you said you only wanted to show the first occurrence of a duplicate.

Posted

When using "go to next" and "omit" together in a loop, you must separate them with an "else," or you'll end up skipping records. I.e., your script omits a record, which puts you on the next record... then it goes to next record... so the record right after the omit is left out of the processing!

Notice in this script I initialize the global field to "" (empty). Thus, the first record does NOT equal the global, so we set the global to that record's PartNo and off we go. The Exit Loop If is just a safety measure so we don't get stuck or lose the last record by mistake.

Show All

Sort

Go To Record [first]

Set Field [ invfile::DupCalc(Global); "" ]

Loop

If [invfile::partno = invfile::Dupcalc]

. Omit Record

Else

. Set Field [invfile::DupCalc; invfile::PartNo]

. Go To Record/Request/Page [Next, Exit after last]

End if

Exit Loop If [ Get ( RecordNumber ) = Get ( FoundCount ) ]

End Loop

Posted

Eureka!!!! It works! This has kicked my rear for a day and a half. I could always omit the second record but not any more that followed. Thank You, Thank You. Ain't this a great Forum.

Ivan

This topic is 7250 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.