Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Order Number problem in Filemaker Pro 12

Posted on 2014-01-21
5
Medium Priority
?
960 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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