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

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

Recommended Posts

  • Newbies
Posted

hi, sorry for this question, but i'm absolutely new here, and one of my costumers asked me to find an answer to this question:

he has a database in fm 4. about 600 fields per record, and in a script he wants to activate a field, where the fields name is written in another field. so, what he did so far was, to run through all fields, always checking (with status actual field) if the name is the same, as the field he is searching for. kinda slow this solution, so he is searching for a faster way to get to the required field.

anybody any ideas???

Posted

This won't help much if you need to work with all 600 fields (600 fields!?), but assuming the named field is only going to be one of a few possible choices:

If (namerField = "field A")

.. Go to field (field A)

Else

....If (namerField = "field B")

.... Go to field (field :

.. Else

etc.

Posted

Your "field name loop" is pretty much the way to do it. 600 fields is a lot.

You might try optimizing the script. These steps at the beginning help loops.

Freeze Window

View as Form

Exit Record/Request

Go to Field (first field, any field, doesn't matter, but speeds up the loop)

If he really needs more speed, he could create some layouts with subsets of the fields, then go to the relevant layout first before looping. Then he'd only have to loop through say 100 rather than 600.

He would then have to use that layout however, as switching layouts loses the field focus.

You would have to associate each field with its layout. I'd use a separate file, which could be populated using Design functions, Fields(Database, Layout), capturing into global fields, then a text file for importing. Or a FM script.

Then you could lookup the Layout name via a relationship from your global "field to go to."

You'd need to go to that layout. Look at the "Dynamic Layout References" file, on the Tips and Downloads page at <http://datatude.net>

Be sure to put the last field on the layout as an Exit Loop condition. This could also be captured from the Layout_Fields file.

In other words, you could have a faster modular script, but some (lots of) effort to set up.

I've attached a small file that does the loop; but not the separate file :-|

FieldOnLayout.zip

Posted

Another method is to loop through all fields checking the name as you go. Put the name of the desired field in global text field gTargetField then execute this script:

Loop

Posted

Bob, isn't that exactly what he's doing already?

Posted

Oops. Right you are. Sorry.

Fenton's suggestion to break things down into subsets is probably the best tradeoff.

But, 600 fields? Sounds like it may be time for a database redesign.

Posted

Okay, I am confused as to what you are trying to do here. So bear with me.

Let me try restating it and see if I have it right.

You have a database with 600 fields in it, thus each record has 600 fields associated. An entry is made into a field in another "form" and you want to then go to that field on the main "form"? Not sure what you mean by "activate" the field. Does that mean "gain focus"?

IF this is what you are talking about then why can't you do something like just make the entry the name of the field you want to go to?

EX:

myField <=== ENTER NAME OF FIELD

then

GO TO FIELD[myField]

My syntax is probably off. But is this possible in FM? If so it would be the easiest fastest way to do this.

This may not be possible in FM tho. So if it isn't I'll just sit back and ponder. cool.gif

  • Newbies
Posted

thanks so far, but, yes, one solution posted here is exactly the way we do it right now (looping trough field names), and yes, you can't go to a field by name. can anybody tell why??? this would be a ******* good feature to have... so, does anybody know of a plugin to do so?

Posted

Maybe we should be asking WHY you want to "activate" the field. Because, although you can't directly GO to a field based on its name entered in another field, you CAN use GetField() to get a RESULT based on a field's name in another field.

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