Next Number Generator
HelpID: 502622029, 502622036
The Next Number Generator is a utility for creating system maintained numbering sequences for any ID field in GP or any 3rd Party Product.
Setup
Navigation: Tools >> Setup >> Company >> Setup GP PowerPack
Mark the box next to MODULE: Next Number Generator*
This feature requires additional setup. Double-click on “Next Number Generator*” to open the Next Number Setup window (see below).
Restart your Dynamics GP client to enable this feature. Other users must restart their Dynamics GP client to enable this feature.
Next Number Generator Setup
Tools >> Setup >> Company >> Setup GP PowerPack. Double-click on “MODULE: Next Number Generator*”.
ID Type: the default options include Item, Customer, Prospect, Vendor, and Other. Additional ID Types can be added (see below Adding ID Types). Select the type of ID for which you want to create a numbering sequence.
ID Name: you may choose to create an unlimited quantity of numbering sequences. This field is an identifier for a specific number sequence. As shown above, the as asterisk before MAIN ensures that numbering sequence will always appear at the top of the list of available numbering sequences.
Only one sequence is allowed that does NOT have a Prefix. The prefix is used when creating the new ID, such as AP00001, to ensure a unique range of number is generated. The AP-range of numbers will not overlap with the SM-range. If there is no prefix, the ID will simply be a zero-filled string, such as 0000023.
Prefix: provide an alpha-numeric prefix. This field is not required, but it can only be left blank for one numbering sequence.
Next Number: provide the starting number. This is the numeric part of the numbering sequence, so you might start at 1, or a random looking number such as 1734.
Length: the system will set this to the maximum length for the selected ID Type (such as 30 for Items). When an ID is generated it will combine the Prefix and the Next Number, with leading zeros padding the numeric portion so that the total length equals the value you entered into the Length field. Carefully plan this so that the Length you select provides enough room for growth of the number.
In the example above, with a prefix of SM, a starting number of 133, and a length of 7, the next number would be SM00133.
Adding ID Types
Click the GoTo button on the Next Number Setup window and select Add ID Type.
ID Type: provide a description for the ID, such as “Employee”. This label will be used when the Menu is added to the window, such as “Next Employee”.
Max Length: enter the maximum length of the field. The Item Number field, for example, has a maximum length of 30-characters. The value you enter here should be the maximum number of characters the field can hold. This is NOT the maximum length of the ID you will use—that might be significantly shorter. The maximum length for the ID is set in the Next Number Setup window.
Product ID: enter the Product ID. If the field is on a core GP window, the Product ID is 0 (zero), and for Manufacturing it is 346. You can locate the Product ID by looking at the Launch File window (Tools >> Setup >> System >> Edit Launch File), or by looking at the Dynamics.SET file.
Hot Key: set a hot key to open Next Number via a keyboard shortcut, such as CTRL + N. A Hot Key is not required, and may be left blank. The following Hot Keys can be used:
-
- A to Z (capital A to capital Z)
- p to z (lower case p to lower case z). These map to F1 to F11, so using “p” will result in the Hot Key CTRL + F1, and “q” will result in CTRL+F2.
- 0-9
Form/Window/Field Names: This information can be found in the Resource Descriptions. An easy way to find this information is to open in Modifier the window where you want to add Next Number Generator. As shown below, Modifier shows the Field, Window and Form names.
After providing the requiring information, click the Binoculars (“Test ID Location”) to validate that the information provided is a field that can be located by Next Number Generator. Next Number Generator will attempt to open the specified window and locate the field.
If the window cannot be opened, you will receive a warning message that the field/window/form information is not correct. Either there is an error in the field/window/form, or Next Number Generator was not able to open the specified window. Try manually opening the window where the field is located, then click the Binoculars again. If Next Number Generator still reports a problem with the field, check the Form, Window and Field name.
TIP: Most window and form names do not have spaces, however some do, and many field names do have spaces. If a form/window/field name has spaces in it, you must surround it with apostrophes. For example:
‘Employee ID’ of window UPR_Employee_MNT of form UPR_Employee_MNT
Using Next Number Generator
When the module is enabled, navigation is added to each of the windows where an ID Type has been created. On these windows the Next Number Lookup can be opened from the Additional menu, or by pressing CTRL+N.
When using Next Number Generator to create “other” ID fields, the easiest way to open Next Number Generator is to add a Shortcut, and assign it to a Keyboard Shortcut Key. To do this, open the Next Number Generator using the navigation above.
-
- On the Next Number Generator window, click File >> Add to Shortcuts
- Right-click on the Shortcut for Next Number Generator, select Shortcut Properties…
- Choose a Keyboard Shortcut and click OK.
The ID Type will automatically set based on which window you have open:
-
- Item Maintenance >> Items
- Customer Maintenance >> Customers
- Prospect Maintenance >> Prospects
- Vendor Maintenance >> Vendors
- Etc
Double-click on the Next Number you want to use. It will be returned to the ID field (such as returning a new Item Number to the Item Maintenance window).
When creating “Other” IDs from the Next Number Lookup, double-click on an ID Class you want to use.
Next Number Generator can be accessed programmatically from outside of GP using a stored procedure called wNextNum. Sample code is shown below:
The parameters are:
ID Type – find IDType in W5026221 for the type of ID you want to generate. For example, 1 = Item.
ID Class – find Class in W5026220.
The example code above would return the Next ID for the Item Number ID-Class of APPLES.
The stored procedure (wNextNum) does not validate whether the ID already exists. When calling wNextNum, your code should validate whether or not the new ID exists in the destination table, and if it does, it should call wNextNum again until it arrives at a new, unique ID. Repeatedly calling wNextNum will increment the next number in the Next Number Generator tables.