Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7446 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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 =)

Posted

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.

Posted

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.

Posted

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. crazy.gif

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. wink.gif

Posted

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!

This topic is 7446 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.