Solved

Order Number problem in Filemaker Pro 12

Posted on 2014-01-21
5
915 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
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 24

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

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

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…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 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

18 Experts available now in Live!

Get 1:1 Help Now