Wednesday, April 18, 2012

GoldMine : Using the Counter Function to Provide a Unique Customer Number

A very handy xBase expression to know is the COUNTER() function.

When you invoke the COUNTER, it returns a sequential number based upon the parameters you give it. This is typically used to provide a sequential Customer Number for Contact Records.

Let's put a Counter in a Field Lookup window for easy access.

1. Bring up the Field Lookup window for the field you wish to modify.

2. Hit "New" to create a new Picklist item.

3. Paste in the following text: ~COUNTER("CustNum",1,1)

4. Hit ok.

Now, when you select this item from the picklist, it will generate the next number in sequence, starting at "1". Try it!

Pro Tips:

The first parameter is the name of our counter. This can be whatever we want. ("MyCounter").

The second parameter defines how large our increment should be. A value of 1 increments by 1, a value of 10 increments by 10.

The third parameter specifies where our counter should start. Typically this is set to 0, however, if a numbering scheme is already in place, this can help generate the right numbers for your sequence.

3 comments:

DJ Hunt said...

Although this is a good example it does not provide uniqueness if in an environment that has Remote Users Synchronizing. Personally, I would rather see this done via the Lookup.ini because of the 29 character limitation of the F2 Lookup List expressions. Here is an example from GoldMine Premium - The Definitive Guide:

[AUTOUPDATE]
NewRecord = Key5

[KEY5]
Otherwise = &&UserName+padl(ltrim(str(counter([AcctNo],1))), 8, [0])

Justin Hill said...

That's a great tip, DJ; thanks! My Tip was mostly geared towards getting GM users more familiar with using xBase within Picklists.

Anonymous said...

As being a luxurious material, Replica Omega is actually remarkably durable too. This tends to be substantially more powerful when it's moist compared to when it's dried out, that models this aside from much less strong supplies for example 100 % cotton as well as man made fiber. Simply because tungsten is really long lasting, it's not gucci handbag outlet sufficient to become size. Which means that, whenever buying wedding ceremony rings within most of the tougher gold and silver, it's important to achieve the proper dimension in advance. However preparing in advance, as well as looking into the actual trade plan for that shop or even web site whenever buying wedding ceremony as well as wedding fake handbags, usually leads to an excellent match as well as design complement. Original appeal is actually an additional extremely valued high quality. chanel replica material includes a organic sparkle that's a indigenous home. Because it's a organic materials, most recent reproduction totes has a tendency to are available in colours associated with suntan, lotion as well as gray that are preferred along with a number of hermes outlet. Entrepreneurs discover the colours natural as well as expert, and people that function within the area using the warmth discover the lighter in weight tones to help the actual organic air conditioning qualities to keep your body heat in a comfy degree.