Solved

Autp record number problem

Posted on 2004-08-23
11
303 Views
Last Modified: 2010-04-27
When I Choose new record, and then I decide to cancel and later on I want to choose new record I gave me extra record number. What script I should use ?  Example will help you to understand better

Example:               Existing record number  =  1000

 [ON CLICK A BUTTON I GET NEW RECORD NUMBER] =   1001

then I decide not to proceed  I choose to cancel /delete

Next day I went back to database and I like to add new record
and the record number should be  1001
                                                                   
But I’m getting record number =  1002

I'm using auto enter serial number with one increment. Some one suggest me to make a script for deletetion when I delete record it should delete record number too , but I'm unable to come up with script.

Please give me complete script

Thanks
 
0
Comment
Question by:gurshaan
  • 3
  • 2
  • 2
  • +1
11 Comments
 
LVL 9

Accepted Solution

by:
prifre earned 125 total points
ID: 11878532
hmmm - I use a swedish FileMaker, so the scripts appear swedish...
but the "delete script" should be something like:

1) set next auto serial number(fieldOfSerialnumber,fieldOfSerialnumber-1)
2) delete the record.

BUT - the above will NOT WORK... The reason is that if you have a button, as soon as you create a record, nothing prevents you from browsing to a different record:
Have existing #1000
Add a new, that becomes #1001
you browse to record #500
you remove record #500 - then you would nave no #500, but you would have two #1001.
So you would have to add to the above script - 3) renumber all record numbers so there are no missing ones. And if it is a big database that might take time (sort on record number, then loop through all records and check if there is anyone missing and fix the numbering by moving fields contents so no "holes" exist)

But you would not be able to use Recordnumber to track the last created record.
I think it is better to THINK differently. Use whatever number FileMaker gives and live with the holes.

Or (to get it faster) - When you delete, delete all field contents, EXCEPT for the record number. And When someone wants to enter a new record, show him the "empty" that has been created already. Thereby you always have numbers filled.

An ever easier way is to use the STATUS (RecordNumber) function  - instead of auto-loop-number. Then you'd always have the correct recordnumber.

So the real question is - what do you actually want to use the number for? To just see a record number on a layout, you can write ## as text and that would automatically show the real recordnumber when you print or do preview.

with a smile
/prifre
0
 
LVL 28

Assisted Solution

by:lesouef
lesouef earned 125 total points
ID: 11886126
I use a simple confirmation msg before creation.
For a stronger check,  I ask the user to enter important data in a few global fields, my script test their value, then creates the new record by copying global fields values to the right fields if everything is valid, otherwise back to record creation layout with a warning msg... but I agree with him, is a non continous serie a problem? there are many ways to count fields or have a unique numbering system without auto functions of FM.
0
 
LVL 19

Expert Comment

by:billmercer
ID: 11893028
gurshaan, I didn't see in any of your questions what version of Filemaker you're using. That could affect your possibilities. If you're using 5.0 you won't have the Set Next Serial script step. I think 5.5 was the first version with this feature.

I agree with the others, this is probably not the problem you think it is. If you just want a sequential number series, follow prifre's suggestion and use the status(recordNumber) function.

Think of the autonumber as a record of database activity rather than just a sequence number. This can be useful when troubleshooting. Also, you can deliberately create gaps as a way of tracking when data was entered.

Example: Last year, the records in a table were all in the range 1000 to 40000. After a major change to our policies was made, I increased the autoincrement to 100,000. Now I can tell at a glance which records are from before the change, without having to remember the date the change was made, or add an extra flag to the table.
0
 
LVL 19

Expert Comment

by:billmercer
ID: 11893100

>if you have a button, as soon as you create a record, nothing
>prevents you from browsing to a different record:

You could just omit all records before creating the new one. Wouldn't prevent a determined user from screwing up, but it would reduce the chance of careless browsing.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:hainaux
ID: 11929104
Unfortunately my FM is in french but I will try to translate the script I use or that :
1- Sort ( no dialog )
2- Display record (last)
3- Define serial number following ( "Number_Field", "Number_Field+1")
Normally after 1000 you will get 1001 even if you have deleted 1001 previously
Good luck
José
0
 
LVL 9

Expert Comment

by:prifre
ID: 12207211
I like my answer. Pity the asker doesnt care.
/prifre
0
 
LVL 28

Expert Comment

by:lesouef
ID: 12208119
fair, he was the 1st to jump on this one!
0
 
LVL 19

Expert Comment

by:billmercer
ID: 12292700
No objection from me...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Conditional Formatting formula in FileMakerPro 10 4 327
FMP auto filed input? 3 122
Filemaker Go to FMS - Low cellular signal 2 77
filemaker server 3 37
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now