Flappy Posted January 13, 2008 Posted January 13, 2008 (edited) I am trying to use a single serial number sequence for two things. When I create a new record, I want a Dec_id number to auto enter the same number as an auto enter serial field (job number). No problem. Then, I want to be able to set the next serial value from that sequence in a third field. I have tried every way I can think of with the "GetNextSerialValue" function I can think of with no success. I suspect I have my syntax wrong, but have not had any luck finding my mistake. test.fp7.zip Edited January 13, 2008 by Guest
comment Posted January 13, 2008 Posted January 13, 2008 I have no idea what this is good for, but you are right to suspect your syntax. If you care to read the help for GetNextSerialValue(), you will see that both parameters must be enclosed in quotes. See also the paragraph marked "Important" here: http://www.filemaker.com/help/Functions%20Ref26.html
Ohgo_Ohgo Posted January 13, 2008 Posted January 13, 2008 Thanks comment: "quotes" around fieldname ! Was my problem too a while ago. Scriptmaker does not complain, to bad ! Just some more additional observation: 1. test seams not a good filename for a Filemaker file. I unzipped it in my downloadfolder it translated to test.4.fp7 because I had a number of other filenames (3) starting with "test" ! ( starting only !). So the hard coded filename "test" from the sample file would have not worked any way. 2. Beside the quotes I changed the hard coded “test” in the script steps to Get(FileName) ( which gives the right “test.4”) but the sample script did not work ! Looks like GetNextSerialValue ( Get(FileName);”FieldName”) works only if the FileName does not include any “.4” ( any dot number ) FileNames with dot text e.g. test.front.fp7 work fine. Just checked hard coded filenames “test.4” ( any dot number ) also does not work. May be that’s also some where hidden as an information in the help files ?
comment Posted January 13, 2008 Posted January 13, 2008 "quotes" around fieldname ! Was my problem too a while ago. Scriptmaker does not complain, to bad ! It doesn't complain, because it is valid syntax, too - IF the actual field name is stored in the referenced field. IOW, it works similar to GetField(). “test.4” ( any dot number ) also does not work. It's not good practice to have file names with periods in them (other than the one preceding the extension). I believe this issue was discussed at some time, and IIRC the solution is: GetNextSerialValue ( Get(FileName) & ".fp7" ; "SerialID" )
Flappy Posted January 13, 2008 Author Posted January 13, 2008 Thanks Comment. I read the help for the function itself over and over, but never made the step back to read the help on design functions themselves. The table I am working with is for order input / job creation. As part of the process, a related record is created in another table (Decorations). This contains the decoration instructions for the products on the order. Most ooccasions, there is only one Decoration ID for an order, so using the job number as the key is convenient and identifies the first order that the set of decorations was used on (handy at reorder time) However, there are times when there are more than one decoration Id needs to be created for a single job number (far less often). When this happens, the decoration id needs to be assured of being unique. It is no problem to do it manually with scripting (how I’ve been doing it), but this new way seemed more elegant.
Ohgo_Ohgo Posted January 13, 2008 Posted January 13, 2008 Get(FileName) & ".fp7" Yes comment thanks. Now I recall ;-)
MelJ Posted February 29, 2008 Posted February 29, 2008 It almost appears that the "GetNextSerialValue" function is actually a Plug-In.
MelJ Posted February 29, 2008 Posted February 29, 2008 I have just found an exception to the "both values enclosed in quotes" statement. ( I'm a newby) If you are storing your file name in a field as I do the following works.... GetNextSerialValue (Globals::Current Program Version Global ; "Builder List::Builder ID" ) If the field name is enclosed in quotes the function produces nothing. I know what you're thinking but I have my reasons.
comment Posted February 29, 2008 Posted February 29, 2008 Well, if you know what I'm thinking, I guess there's no point in me saying it, is there?
Recommended Posts
This topic is 6172 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now