Jump 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.

creating duplicate (multiple) records IDEA

Featured Replies

Hello there,

Trying to find a good way to duplicate records for printing using a numberfield (Quantity) that tells the amount of labels you want of that record. I found a few solutions but they all involved another file and I wish to keep it that limited to 1 extra file that imports the records for print.

I've created this script that activates this subscript in the Printer file when if finds Quantity > 1 on a record somewhere. Really would like to know what you think about it because I just started with FM Pro.

field Quantity: gives the user the ability to give the amount of labelprints. replaced [ ] with ( )

Set Error Capture (On) # for the cancel

Loop # I've put the loop here because Duplicate Record put the selected record below and it will otherwise miss some records that needs to be duplicated

Perform Find (Restore) # this searches in field Quantity to > 1

if ["Status(CurrentError) = "401"] # To get out of the loop

Show All Records

Exit Script

Else

Sort (Restore, No dialog)

# sorts the field Quantity ascending, not really needed but I put it here incase I find a better script order

If ["PatternCount (Quantity, "2") = 1"] # finds the first time the field Quantity contains "2"

Set Field ("Quantity", "1")

# this record will be duplicated and printed 1 time, prevents it from being duplicated again

Duplicate Record/Request # duplicating the selected record

End if

If ("PatternCount(Quanitity), "3" = 1")

# finds the record that needs to be duplicated twice to create 3 labelprint

Set Field ("Qunatity", "1")

Duplicate Record/Request

# perhaps a loop is needed here because when I want it duplicated 15 times it sure is getting a long script. I'm not to good with the loops yet, plz help

Duplicate Record/Request

End if

End if

End loop

The drawback is that the speed of the script aint very good because it starts the loop from the top each time with a Perform Find. It would be great if it go's to the next record that needs to be duplicated but I notice that when it performs Duplicate Record it go's to the bottom and skips other records that need to be duplicated. So I use the Perform Find to go to the top.

I hope this idea of mine aint to crazy to understand and you are able to give me a hand with this.

Thanks in advance...

Rakesh

Printer.zip

I can see two problems.

1. The duplicated records will be at the end of the file. So, you will have to sort before printing to get the duplicates arranged together with the original. That's not a major problem though.

2. When you are finished printing, you will have to delete the duplicates. This won't be a problem either if you have some means to identify them, but it may be time consuming.

Although I recommend using the second file method to print multiple labels, here is a simple method that uses a single file and doesn't create any duplicate records:


Set Error Capture [on]

Set Field [gLabelCount,0]

Loop

  Enter Find Mode [restore (or not)]

  Set Field [LabelQuantity, ">"&gLabelCount]

  Perform Find [no restore]

  Exit Loop If [status(CurrentFoundCount)=0]

  Print

  Set Field [gLabelCount,gLabelCount+1]

End Loop

This script is far from perfect though. What it does is find all records that have a label quantity of 1 or more and prints them. Then it finds all records that have a label quantity of 2 or more and prints them. Then 3 or more etc. It exits out of the loop when it gets to a number higher than the maximum label quantity, and no records are found. The disadvantage is that multiple print operations are done which will result in some blank labels at the end of the last sheet for each print operation. Also the duplicate labels will not be together.

  • 3 weeks later...
  • Author

Thanks Bob for your interest in my idea.

In my situation I have a separate file that imports the records to print and after this duplicate script I run a sort, print and then deletes all imported records.

I'm afraid I won't use the loop print. Like you said it will give multiple print operations.

I come to the conclusion that my IDEA might be interesting if you don't need more then a few duplicate records. Otherwise the script by markpro #30337 is more usefull and a lot quicker.

Thanks for your interest.

Create an account or sign in to comment

Important Information

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

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.