July 1, 200421 yr Can anybody help me with a simple create related record script? I Want to auto-create a new record in a "History File" that is related to the "Receipt File". Both files have the field: receipt# which I made as the matching field. My global field is "global_receipt#". This is what I made so far. (I'm using Filemaker 6). Set Field ["global_receipt#", "receipt#") Freeze Window Go to Related Record ["History File"] New Record/Request Set Field ["History File::receipt#", "global_receipt#] When I tried to run this script from the "Receipt File", the script created a new record in the "Receipt File" instead of creating a new record in the "History File". Did I miss a script step? I hope somebody can enlighten me on this part. Thanx, Chard =)
July 1, 200421 yr You can not use Go To Related [] script step here because you don't have a relationship established yet between the Receipt#s (the one in History doesn't exist yet). You need two scripts: Your receipt script - Set Field [global_receipt#, receipt#) Freeze Window Perform subscript, external (History.fp5; new record script name here) History new record script - New Record/Request Set Field [receipt#, Receipt::global_receipt#] You may need a Refresh Window/Bring to Front (or something else) at the end of your main script if you wish to create your new record and then return Users to your receipts.
July 2, 200421 yr Author Thanks! It worked. I never knew how that perform subscript works, and thanks to you I know now. Hey, can I ask you something else? Is a repeating field like an array that stores multiple values in a single variable? Coz I want to add it to the script you mentioned above. Like if the "Receipt File" has 5 repeating fields named "contents", I want the script to automatically make 5 new records in the "History File" with the same receipt# but with a different value in an "item" field based on the values of the "contents" repeating field. So I'm thinking adding a Loop statement before the New Record/Request. But how do you count the number of repeating fields? And what is the correct function to use in getting the values of the repeating fields? I hope your great wisdom can enlighten me again... Its great to learn new things everyday. Thanx again.
July 3, 200421 yr 5 repeating fields in Receipts to hold Contents? I suggest you consider alternatives first, such as a related file, Value List, array or multiline. In fact, your History sounds like it should BE your Receipts. Duplication of data (in Receipts and then in History) usually isn't necessary. History can just be a rolling log of your Receipts, I would think. But I don't know your setup. Repeating fields have their place and I've even used them for limited-access data before but I hesitate to suggest using them for receipts which you may need to find, sort or summarize ... particularly in < 7. Maybe if you explained a bit more, we can give you additional ideas; otherwise, we will need to call upon the repeating field experts out there, because I'm not one.
July 4, 200421 yr Author Yup my setup requires a history file that results in a duplicaion of some data. But anyway, I decided to use a portal in my receipt file. It took me some time, but I finally figured it out how to extract data from the portal row by row. My script looks ugly but it works. I was just curious about the repeating field concept because I have never used repeating fields so far in my projects. Thanks again for the reply, have a nice day!
Create an account or sign in to comment