Jump to content

There must be a way to elegantly loop this...


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

Recommended Posts

Greets, all, and I hope you're in for some eats and treats later in the week.

Please refer to the attached. What I'm doing is creating ten child records with the creation of each parent; each child is populated with a different value (in quotations) destined for the Inclusion__lxt field.

As is, it works, but it's clunky; in my never-ending quest to become more competent with FileMaker, I'm sure there's an elegant way to loop this but I don't know how. (I'm sure it involves an Increment-type step to pick the appropriate value with each iteration, but I be flummoxed.)

As always, your help is appreciated. Thanks!

 

 

Screenshot 2015-11-22 22.46.06.png

Link to comment
Share on other sites

Set Variable [ $list ; "Awards¶CV¶Military¶Objective etc...  ]
# Hopefully this is a value list or records in a table instead or separate the values using List ( "Awards" ; "CV" ) etc.
Set Variable [ $ParentID ; RESUME_INCLUSION::_kflt__ResumeParentID]
Freeze Window
Go to Layout [ based upon child table ]
New Record/Request
Set Field [ child::parentID ; $ParentID ]
Loop
Set Variable [ $i ; $i + 1 ]
Set Field [ child::Inclusion ; GetValue ( $list ; $i ]
Exit Loop If [ $i > ValueCount ( $list ) ]
Duplicate Record
#in this way, the child record inherits the parentID so it does not need to be set
End Loop
Go To Layout [ original layout ]

This is untested.

Sorry I didn't follow your table/field names exactly ... I usually do.  But when they are not easy enough to type by hand, it is frustrating to me and I drop them, particularly stuff like '_kflt__'  :-)

Link to comment
Share on other sites

2 hours ago, WF7A said:

I'm sure there's an elegant way to loop this

Actually, the elegant way is to create records only when you have something real to put into them.

If you want to present your users with a "grid" against which they can enter data, use a portal to a table of Attributes (where each one of Awards, CV, Education, etc. is an individual record) that can create records in the "real" child table - see a similar example here: http://fmforums.com/topic/98488-show-a-portal-of-potential-entries-not-yet-created-based-on-dates/?do=findComment&comment=447756

 

Link to comment
Share on other sites

Thank you both! I'll play with your solutions today.--it'll be nice and quiet in the office this week so I'll be able to spend some time with them. Cheers!

Link to comment
Share on other sites

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