Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script Problem (show 1st occurance of duplicate)

Featured Replies

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

Move the If script step to just under Loop, and add an Exit Loop within.

  • Author

I don't understand the "add an Exit loop within".

Ivan

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.

  • Author

I stil cant get it to work. Can you attach an example?

TIA

Ivan

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

  • Author

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.