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

Set fields depending on stored fieldnames


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

Recommended Posts

  • Newbies
Posted

I started using Filemaker 5 months ago and I have quite a complicated task to do. I was wondering if there is a way, in a script, to set a particular field whose name is stored in another field.

For example if I want to loop through some fields whose names are field1, field2, etc. So I thought I could store a count in a field (called "count", say) and then use it so that in each pass of the loop it sets the field named "field" + count.

If this is not possible I may have to bombard you all with the task in all its glorious entirety! confused.gif

Posted

Hi,

No, you can't set dynamically select the field to be targetted. It has to be clearly specified in the SetField[ ] script step.

You'd need to loop through all fields, in a "All Fields" layout and stop when Status(CurrentFieldName) = the content of your fieldName.

It may appear tedious, but you may reduce the processing time by dropping your fields in 5 different layouts according to their types (text fields, num fields, hour fields, date fields, Container Fields) and then use the correct layout depending on the FieldType.

HTH

Posted

It is possible to set a field, somewhat indirectly, based on its name; or its relative location on a known layout. But it's tricky.

You cannot directly specify a field to set by name. The only way (I know) is to Loop through the fields, using the Go To Next Field step (after starting at the beginning; definitely ending at the end), on a specified layout and tab order.

You can Exit Loop when you get to the field, by comparing Status (CurrentFieldName) to a name in a global field. Or, as you say, to an incrementing count. You can Set Field [ , the data ], NOT specifying the field; it will use the current field.

Exit Record pulls you out of all fields. Go To Field [Next] will then go to the 1st field.

FieldOnLayout.zip

  • Newbies
Posted

Thanks Everybody!

I managed to do it by looping through all fields. It was a bit tricky and I pulled my hair out a lot but it works finally!

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