Solved

Order Number problem in Filemaker Pro 12

Posted on 2014-01-21
5
935 Views
Last Modified: 2014-01-23
I have a serial number field i want to use to create an order number. However, even if i exit the record without saving, the number increments. How can I stop this happening and get the Order Number to increment only when I have saved the record? P.S. I am totally new to this, help wpould be much appreciated.
0
Comment
Question by:howardl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
Will Loving earned 500 total points
ID: 39798687
The Auto-Enter Serial Number function applies the Serial Number and increments the hidden "Next Serial Value" when you create the record. If you don't save the record, the "Next…" value is still incremented and used the next time you start a record. It doesn't reset backwards because the Serial Number has already been used.

If you want to reset the "Next Serial Value…" value anytime you cancel a record, then you would need to add a "Set Next Serial Value" script step to the Cancel script. The calculation needs to be able to determine the Maximum Serial value currently used and set the serial value to the next one. You can't just set it back to the previous value because another user might have already gone ahead and created a new record, using the "Next" value and incrementing it again.

In other words, while you can try to avoid skipped serial numbers, unless you are and always will be the only user of the file - meaning it's not hosted or setup as a multi-user database you'll only be able to set the serial number to the maximum serial number used. There are ways to avoid skipped order numbers but they are fairly complicated and likely not worth the effort to learn how to do it.

There are a couple of ways to determine the Maximum current serial number and set the appropriate "Next.." value. The main one would be to create a Self-Join relationship between the table and itself using the "cartesian" or "X" relationship option. This relates all records to all other records. I've called the relationship "Orders_SJ" Then you use the Max() function to determine the max value and add one:

Max( Orders_SJ::OrderNumber )
0
 

Author Comment

by:howardl
ID: 39802506
Thank you for you quick response. Unfortunately I have not been able to make this work due to my newbie status. I am accepting your soultion but could you just point me in the right direction to achieve this, e.g. where to place the script?

Thank you Will
0
 
LVL 25

Expert Comment

by:Will Loving
ID: 39803216
Well, the first question is: Do you have a script that cancels the new record? Perhaps a button that either runs a script step or an actual script? Scripts are listed under the Scripts menu. You can determine what is connected to a button by going into Layout Mode and double clicking on it.

As far as making the Self-Join relationship, you go to File -> Manage -> Database. In the relationship diagram you'll see one or more tables. You need to duplicate the existing table, I'm guessing it's called Orders, and name it something like Order_SJ. Then create a relationship between the two Table Occurrences (aka "TO") from the Order Number field in one to the Order Number field in the other. Be sure to select the "X" option rather than "=" in the Edit Relationship dialog. That gives you the relationships you need. Once you have that you can base calculations on it such as the Max() formula I gave you above.
0
 

Author Comment

by:howardl
ID: 39803386
Thank you so much Will.
0
 

Author Closing Comment

by:howardl
ID: 39805260
Really appreciate this
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

724 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