Newbies FrinkTheBrave Posted November 10, 2004 Newbies Posted November 10, 2004 Hallo, I'm new to FM Pro 6 and scripting. If I have a record with a ItemCode and an integer Count, how would I create 'Count' records in a second table with the same ItemCode. Any help nuch appreciated, - Frink
-Queue- Posted November 10, 2004 Posted November 10, 2004 See attached for sample technique. Note that this will only work once for each ItemCode unless a larger number is used. For example, once 5 related records are created for ItemCode A1, 5 more can not be created unless you specify 10 in ItemCount. It could be tweaked to work differently though. Feel free to ask any questions you might have. CreateXRelated.zip
Newbies FrinkTheBrave Posted November 11, 2004 Author Newbies Posted November 11, 2004 Thanks for replying. Your code worked well. As you might guess I have some more questions though. 1. Your serial fields are defined as calculated value: Status(CurrentRecordID) Is it better to use that formulae, rather than serial number Auto Value? I assume that does the same. 2. I've had a long look at the code and think I understand it! Am I right in thinking that there is no 'create record' as such, but just writing the temp value using the relationship creates the record and copies the ItemCount value because of the ItemCount relationship? 3. I found the Pause/Resume script step. Is there any way of putting 'debug' statements in the code, like popup messages or writing stuff to a file or the screen, or any way of finding out which pause/resume step is being stopped at? Thanks again for your reply, - Frink
-Queue- Posted November 11, 2004 Posted November 11, 2004 1. I just use a serial calc in my sample files as that's what I'm used to doing. 2. FileMaker has a burning desire to set the field you specify, no matter what. So if the field is a related one and the relationship isn't currently established, it will force it to be by creating a new related record and setting the related key field before setting the data field. This is a nifty technique that avoids setting a global with the serial, calling a subscript in the related file to create a new record, set its serial with the global, and then populate the data fields. It does all of it in one step by referencing a non-established relationship. The key is then nullified once the data fields are set, so that when the relationship is next referenced, a new record is once again created instead of the existing one being used. 3. Use Show Custom Dialog instead of Pause/Resume.
Recommended Posts
This topic is 7316 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