Seems to me you should be using Get(ActiveFieldTableName)) & "::" & Get(ActiveFieldName))
It isn't clear what GetFieldName really accomplishes.
Thanks for the tip - your function has a typo - it should be Get(ActiveFieldTableName) & "::" & Get(ActiveFieldName)
BTW - can you think of any reason why you would want to use the GetFieldName instead?
I, too, have not found any use or purpose for GetFieldName. We already had the combo of Get(ActiveFieldTableName) and Get(ActiveFieldName) and between the two of them we can get accurate fully qualified field name data for the active field, whereas GetFieldName does not do it with dependable accuracy when the active field is not of the layout's native table.
I guess GetFieldName() can also do indirect referencing (i.e., instead of the ACTIVE field can give you info on a field the name of which is in some Field or $Variable) but heck if you already have the fieldname inside a field or variable what do you need with GetFieldName?
I have seen an example where Get ( FieldName ) was used in a calculated parameter so that the current name of the current field could be used in a SetField by Name script step.
The technique neatly kept the script from breaking should the developer later decide to change the name of the referenced field.
Yes, but you can do that kind of thing with older functions such as GetField or Get (ActiveFieldName).
"...you can do that kind of thing with older functions such as GetField"
Get Field returns the contents of a specified field. GetFieldName returns the name of the field.
"...or Get (ActiveFieldName)"
If the field in question is the active field, which was not the case in the script example posted in the Using Filemaker Forum a month or so ago to which I am referring.
"Get Field returns the contents of a specified field. GetFieldName returns the name of the field.
Well, reading Help ummmm helps - GetField can return either:
GetField("Arrow") returns Target. Notice the use of quotation marks around Arrow to indicate the literal string is the fieldName parameter.
GetField(Arrow) returns Bullseye. Notice the absence of quotation marks to indicate the value stored in the Arrow field is the fieldName parameter.
So it certainly can return the name of a field if the field is stored in a field (which it can easily be in different scripting circumstancaes) I use GetField and a global to set various fields using Set Field By Name.
added this ... my point I guess is that I agree with A Hunter3 ... the last sentence of his.
Actually I did read the help file just before I posted. :smileywink:
Both arrow and "arrow" examples return field content--not field names.
GetField(arrow) returns the contents of the field Target
GetField ("Arrow") returns the contents of the field Arrow--which happens in this example to store "Target" the name of a different field.
GetFieldName, on the other hand, returns only the name of the field--not its contents.
Here's a generalized outline of the method:
In a script, you have a series of operations that will need to be performed on fieldA if the user clicks button 1 and the same operations should be peformed on FieldB if they click button 2.
Write the script:
Set Field By Name [ Get (scriptParameter) ; //Put complex expression here]
Set up the buttons.
Set up button one with the calculated parameter: GetFieldname (table::FieldA)
Set up button two with the calculated parameter: GetFieldName (table::FieldB)
Now the same script modifies two different fields depending on which button is clicked and changing either the table or field name in Manage Database does not break the script.
Admittedly, there are other ways to do this, but this is the method I was referring to.
What am I missing:
I have inserted the following step as the first step in my script: Table and Layout Table are the same:
$T1= Set Variable [$T1; Value:GetFieldName (Evaluate(Get(ActiveFieldNmae)))]
When the text field button executes the script I would expect Data Viewer to show $T1="name fo button field". Instead I get "?".
Field is set to text and recalculate as needed. Can anyone help me understand this?
Thank you for your post.
In the Data Viewer, make sure you are monitoring $T1. That is, click the "Watch" tab in Data Viewer. Then, click the "+" icon in the lower right area of the window, and enter $T1 and click "Monitor". $T1 will then be displayed when it is encountered in the script.