Solved

Order Number problem in Filemaker Pro 12

Posted on 2014-01-21
5
901 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
  • 3
  • 2
5 Comments
 
LVL 24

Accepted Solution

by:
Will Loving earned 500 total points
Comment Utility
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
Comment Utility
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 24

Expert Comment

by:Will Loving
Comment Utility
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
Comment Utility
Thank you so much Will.
0
 

Author Closing Comment

by:howardl
Comment Utility
Really appreciate this
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

12 Experts available now in Live!

Get 1:1 Help Now