Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

How to create multiple related records?


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

Recommended Posts

Posted

I would like to be able to create multiple new related records (letters) based upon a found set in (dwellings) using key field (license #.)

I know how to do this one at a time with scripting (create new record and copy/paste the key field) - can this be done with many records at a time? Not sure how to get the right number of records created, and how to insert the key fields....

Any help - MUCH appreciated!

Posted

Copy/paste should pretty much always be avoided. There are several ways to gather a list into a variable and then process the list.

Set variable [ $list; "A¶B¶C¶D"]

Set variable [ $n; valueCount( $list}]

Set variable [$k; 1]

Loop

Exit loop if ($k > $n)

New record

Set somefield; getValue( $list; $k)

Set variable [ $k; $k + 1]

End loop

Posted (edited)

Ok - I think I see how the variable and loop works.

I'm not quite following the first portion of this script:

Set variable [ $list; "A¶B¶C¶D"]

Do I have to establish a repitition number for the variable? (this will vary, and could be in the 200-300 range at times)

{EDIT: it looks to me like Get(FoundCount) would work here - am I on the right track??}

{EDIT#2: so found count can get me the number of items in the found list. The loop can then create a new record, and set the key field to the next value in the list... How do I get the individual license numbers into my variable "list"?

Edited by Guest
still learning!
Posted

No, you do not need to use a repetition number. The example variable just shows how a variable can contain a list. You will have to use a loop to walk the records and collect the list of values.

Set variable [ $list; "" ]

Go to record [ first ]

Loop

Set variable [ $list; list ( $list; your::field) ]

Go to next record, exit after last

End loop

Posted (edited)

No, you do not need to use a repetition number. The example variable just shows how a variable can contain a list. You will have to use a loop to walk the records and collect the list of values.

Set variable [ $list; "" ]

Go to record [ first ]

Loop

Set variable [ $list; list ( $list; your::field) ]

Go to next record, exit after last

End loop

Thanks - this makes more sense, especially after studying the LIST function and realizing it does not work across a found set, but on a record and related records.

Regarding the loop above - can I really use "exit after last record" - or was this more of a shorthand way of saying write the script to advance one and compare, then leave when k>n?:(

Edited by Guest
clarification
Posted

Disregard - found the Next(exit after last) script step!

Thanks - this makes more sense, especially after studying the LIST function and realizing it does not work across a found set, but on a record and related records.

Regarding the loop above - can I really use "exit after last record" - or was this more of a shorthand way of saying write the script to advance one and compare, then leave when k>n?:(

This topic is 5174 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.