dbTalk Databases Forums  

How to get the next number (FM 7 Win XP)

comp.databases.filemaker comp.databases.filemaker


Discuss How to get the next number (FM 7 Win XP) in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Claude Carlos
 
Posts: n/a

Default How to get the next number (FM 7 Win XP) - 09-19-2005 , 04:31 PM






I'm creating a client file and I want to assign automaticaly a number to
each client.
I want to get the Next number.
For example. The last client has number 1234
I want to add a new client, so the next number shoul be 1235.
I want that process to be automatic, I don't want to have to look up the
largest number.

Thanks



Reply With Quote
  #2  
Old   
Claude Carlos
 
Posts: n/a

Default Re: How to get the next number (FM 7 Win XP) - 09-19-2005 , 05:56 PM






I just found the answer

Autoenter serial number .


"Claude Carlos" <carlos.cl (AT) videotron (DOT) ca> a écrit dans le message de news:
L6GXe.12261$2T5.182794 (AT) wagner (DOT) videotron.net...
Quote:
I'm creating a client file and I want to assign automaticaly a number to
each client.
I want to get the Next number.
For example. The last client has number 1234
I want to add a new client, so the next number shoul be 1235.
I want that process to be automatic, I don't want to have to look up the
largest number.

Thanks





Reply With Quote
  #3  
Old   
Helpful Harry
 
Posts: n/a

Default Re: How to get the next number (FM 7 Win XP) - 09-19-2005 , 06:01 PM



In article <L6GXe.12261$2T5.182794 (AT) wagner (DOT) videotron.net>, "Claude
Carlos" <carlos.cl (AT) videotron (DOT) ca> wrote:

Quote:
I'm creating a client file and I want to assign automaticaly a number to
each client.
I want to get the Next number.
For example. The last client has number 1234
I want to add a new client, so the next number shoul be 1235.
I want that process to be automatic, I don't want to have to look up the
largest number.
Check the Options for your ClientNumber field in the Define Fields
window. As long as it's either a Number or Text field you'll find an
auto-enter option that is "Serial Number". This serial number can be
preset to start (with the next new record) at whatever value you want,
and will then automatically increment by 1 or any value you specify and
will automatically be entered into the field as each new record is
created.

One useful note: this Serial "Number" doesn't actually have to be just
a number. For example your ClientNumber field could actually use serial
numbers of CN0003, CN0004, CN0005, etc. The letters are ignored by
FileMaker when it increments the serial number. This can be very useful
in a multi-file / table system where each file / table has it's own
serial number field - you can then have ClientNumber (CNxxxx),
JobNumber (JNxxxx), OrderNumber (ONxxxx), etc.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #4  
Old   
Claude Carlos
 
Posts: n/a

Default Re: How to get the next number (FM 7 Win XP) - 09-19-2005 , 06:02 PM



I spoke to fast....

If I use the auto enter, I'm stuck if a user wants to update a solution and
import records.
He would have to reset the starting value of the serial number.

Since the solution will be a runtime, I don't think he has access to that
option
and even if he did, I don't want the user to modify that number

I'm open to any suggestions

Thanks again
"Claude Carlos" <carlos.cl (AT) videotron (DOT) ca> a écrit dans le message de news:
cmHXe.12274$2T5.196860 (AT) wagner (DOT) videotron.net...
Quote:
I just found the answer

Autoenter serial number .


"Claude Carlos" <carlos.cl (AT) videotron (DOT) ca> a écrit dans le message de news:
L6GXe.12261$2T5.182794 (AT) wagner (DOT) videotron.net...
I'm creating a client file and I want to assign automaticaly a number to
each client.
I want to get the Next number.
For example. The last client has number 1234
I want to add a new client, so the next number shoul be 1235.
I want that process to be automatic, I don't want to have to look up the
largest number.

Thanks







Reply With Quote
  #5  
Old   
Helpful Harry
 
Posts: n/a

Default Re: How to get the next number (FM 7 Win XP) - 09-20-2005 , 11:31 PM



In article <osHXe.12277$2T5.198850 (AT) wagner (DOT) videotron.net>, "Claude
Carlos" <carlos.cl (AT) videotron (DOT) ca> wrote:

Quote:
I spoke to fast....

If I use the auto enter, I'm stuck if a user wants to update a solution and
import records.
He would have to reset the starting value of the serial number.

Since the solution will be a runtime, I don't think he has access to that
option
and even if he did, I don't want the user to modify that number

I'm open to any suggestions
From FileMaker 5 (or maybe 5.5) onwards there is a Script command
called "Set Next Serial Value" that allows the script to preset the
Next number that the auto-enter Serial Numebr option uses for a field.
This command is found right at the bottom of the list in the
Miscellaneous section. (Note: I'm not sure if the command has been
renamed in FileMaker 7 or not.)

This means you can write an Import script something along the lines of:

Import Records
Show All Records
Sort by MySerialField [Descending]
Go To Record [First]
Set Next Serial Value [MySerialField, MySerialField + 1]

Instead of sorting the records you could use either a Summary field or
a Relationship link to find the maximum current serial number.


The other way is for your solution to have its own "Preferences" layout
the user can access where they can modify various attributes stored in
Global fields (eg. their name or company name, etc.). In this case
there would be a Global field into which they can type the next serial
number and then click a "Set" a button that runs a script using the
"Set Next Serial Value".



Note: When importing records you may need to make sure to turn off the
"Perform auto-enter options while importing" option that appears in the
window after setting the field order. If you leave that turned on and
don't import the Serial field data, then the records will be renumbered
which can cause havoc with Relationship links.




Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #6  
Old   
Matt Wills
 
Posts: n/a

Default Re: How to get the next number (FM 7 Win XP) - 09-23-2005 , 03:43 PM



Claude Carlos wrote on (9/19/2005):

Quote:
I'm creating a client file and I want to assign automaticaly a number to
each client.
I want to get the Next number.
For example. The last client has number 1234
I want to add a new client, so the next number shoul be 1235.
I want that process to be automatic, I don't want to have to look up the
largest number.

Thanks
There has been considerable discussion of this in the FMExperts list
recently, various folk extolling the virtues of their own method of
creating unique IDs to be used as table keys.

The idea is not to depend entirely on just a simple serial number, but to
concatenate a variety of things together that reduce the likelihood of
duplication.

My favorite is quite simple:

A modified Julian date on which the record is created (first two
characters are the year, next three characters are the day of the year)
followed by the user's initials, followed by a sequential number. Thus,
the first record I create on September 23, 2005 would be keyed:

05-266-MFW-001

(With or without hyphens)

The ID assignment is scripted separate from simple creation of a new record.

Go wherever your imagination takes you. The more different things you
throw in (date, time, phase of the moon, a random number) the less likely
a duplication will occur.

Matt

--



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.