Jump to content

Can I use the name name of a field to access its contents


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

Recommended Posts

I would like to test the contents of each field in a layout. I can get the names of the fields by using the FieldNames function. I can separate them out in sequence. But then I am stuck about how to use those names to access the contents of each field.

Link to comment
Share on other sites

There is no way to use the field name as a variable. You will need to explicitly test each field.

What are you trying to do? There is probably a different way to do it in FM. Some of the classical programming thinking doesn't really apply to FM. -bd

Link to comment
Share on other sites

There is actually a rather convoluted way to do this using a script. It involves going from field to field and checking the current field name. Like so:

code:


Set Field [gFieldCount, 1]

Go to Field [AnyField]

Loop

If [(Status(CurrentFieldName)=gSearchFieldName)]

Copy[]

Paste[gResult]

Exit Loop If [1]

End If

Set Field [gFieldCount, gFieldCount + 1]

Exit Loop If [(gFieldCount > 20)]

Go to Next Field

End Loop


If you enter the name of a field into gSearchFieldName and then run the script, that field's contents will be pasted into gResult.

Link to comment
Share on other sites

quote:

Originally posted by LiveOak:

There is no way to use the field name as a variable. You will need to explicitly test each field.

What are you trying to do? There is probably a different way to do it in FM. Some of the classical programming thinking doesn't really apply to FM. -bd

I am trying to get the contents of the current set of find requests and put them into a global text field in the header of a column layout. This kind of information is available on printouts of scripts but I cannot find a way to make it easily accessible to users. I want to cycle through the fields of the request set and put the contents of the non-blank fields into a text field.

Link to comment
Share on other sites

The usual way to approach this is to have the user enter find requests into global fields in

Browse mode. Then the informatin is already available for display, use in report titles, etc. The script transfers to Find mode and fills the actual request fields. With creative scripting you can implement everything that you can enter in find mode with this approach. -bd

[This message has been edited by LiveOak (edited February 02, 2001).]

Link to comment
Share on other sites

This topic is 7863 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
 Share

×
×
  • Create New...

Important Information

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