Anuviel Posted May 9, 2008 Posted May 9, 2008 Is it possible to reference field names via parameters? For example instead of using Table::Field could one use Table:$$Test where $$Test would be a parameter set to the name of the field? I tried it and it does not work, is there a different way to achieve that or does it just not work? I really do not have / need to use it but am just wondering if it can be done as it might be useful in my future projects. Thanks.,
Lee Smith Posted May 9, 2008 Posted May 9, 2008 If I'm understand your question, and the field is called [color:blue]Test, then you Set Variable [ $$Test; YourTable:[color:blue]Test ] If this isn't what you meant, let us know. HTH Lee
Anuviel Posted May 9, 2008 Author Posted May 9, 2008 Not exactly. The example you put would get the value of the field into the parameter, not the field name and field name is not the issue - I might have poorly explained what I wanted so I will try again. I am thinking of using parameters to reference field name, not field value. Something like: 1. Table Name is Weight 2. Field name is Test 3. Field name is Actual_Weight 4. Optional Script Parameter is Test 5. Set Variable [$$Field; Value:Get(ScriptParameter)] 6. Set Field [Weight:$$Field; Weight::Actual_Weight] If I reference field name as seen in step 6 I get message field cannot be found. What I am thinking is using the script parameter to reference fields in calculation rather then having to use field names if possible. Hope the explanation is a bit better this time around. If not I can try again. Thanks.,
Anuviel Posted May 9, 2008 Author Posted May 9, 2008 (edited) Could it be used vice versa in any way? Instead of 6. Set Field [Weight:$$Field; Weight::Actual_Weight] like this 6. Set Field [Weight::Actual_Weight; Weight::$$Field] Thanks., Edited May 9, 2008 by Guest
comment Posted May 9, 2008 Posted May 9, 2008 Maybe like this: Set Field [ Weight::Actual_Weight ; Evaluate ( "Weight::" & $$Field ) ]
fabriceN Posted May 9, 2008 Posted May 9, 2008 (edited) For the first thing (setting a field dynamically), you can use a plug-in such as DoSQL, or a loop on a layout until the active field name is what you want. You can also use GoTo object. The problem with these two is that you need to be sure the field is on the layout. This is what FM xLayout Assistant does for you (delivered with a FileMaker script to set a field dynamically). As for your second request, as Comment said, you have the Evaluate function, and even GetField, which is supposed to be a little faster. Edited May 9, 2008 by Guest
Recommended Posts
This topic is 6102 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 accountSign in
Already have an account? Sign in here.
Sign In Now