Jump to content
Sign in to follow this  
Mr. Ignoramus

Get Field Name

Recommended Posts

Hi,

I need to get the Name of the Field when the user clicks on it!

Why, I have many fields that I do not want to allow access to if my Project Closed fields has the letter "C" in it.

And Filemaker's Field Validation is completely confusing to me

GetFieldName ( field )

GetField ( fieldName )

And since I don't know which field a user will click, I was hoping to assign the name of the field to a variable to use in the next to last last script step.

GetFieldName ( Field ) to me, means that if a user clicks on a field and I've assigned a script to trigger, Filemaker would get the name of the field I've defined in the database.

I'm not interested in the content of the field, just the field name.

Filemaker won't allow the first step, I must replace "Field" with something. And again I have no idea which of the 5 fields the user is going to click. I am hopeful that I won't have to write five individual scripts for each fields. Any assistance with the following script I would be grateful :-)

$Set Field Name [ GetFieldName ( Field ) ]

If [ Project::OCD = "C"]

Show Custom Dialog ["Project Closed, no changes allowed. Thank you. ]

Commit Records / Request []

Else

Go to Field [ $Set Field Name ]

End If

Exit Script

To me, the above script should work, but nooooope! Hmm ...

Thank you.

Tom

Share this post


Link to post
Share on other sites

Why not just create a second layout that is identical in every way except that the fields are locked? Changing the status to "closed" or "open" would run a little script that just toggles the layouts back and forth.

Share this post


Link to post
Share on other sites

Or use one layout with a tab control object.

Even with your approach, the actual field name is not required:

If [ Project::OCD = "C" ]

Show Custom Dialog [ ... ]

Commit Records [ ]

End If

should be quite sufficient.

See also:

http://www.filemaker.com/12help/html/func_ref2.32.6.html#1028330

http://www.filemaker.com/12help/html/func_ref2.32.7.html#1028373

Share this post


Link to post
Share on other sites

Get (ActiveFieldName) will return the name of the currently active field.

However - i agree with the previous two posts :)

Share this post


Link to post
Share on other sites

If [ Project::OCD = "C" ]

Show Custom Dialog [ ... ]

Exit Script [ ]

End If

Yes I tried this, but if the statement is false I still want the user to go to the field they clicked on and they don't.

I have no active fields.

And no clue which field the user will click on that are available for data entry.

All I want to do is get the name of the field the user clicks on, that is all I want to do. And, even if I were to get it, I am still unable to enter any variable in "Go to Field [ ]" Filemaker only allows me to enter an actual field from the available fields in the window that is displayed. And since again, I have no active field and I have no clue which field the user will click on ....

How can I get the field name ??? Not the Field content.

Is that even possible ???

If I could do it in a Function, is there somebody here who could guide me ??

I would be grateful.

Thank you.

Tom

Share this post


Link to post
Share on other sites

Yes I tried this, but if the statement is false I still want the user to go to the field they clicked on and they don't.

If the script is triggered on entering the field, then the user is already in the field. If you don't kick them out, they will stay there.

Share this post


Link to post
Share on other sites

That is what I thought but for some reason when the script runs the fields selection cancels. Huh ???

If [ Projects::Project OCD = "C" ]

Show Customer Dialog [ Message; Project closed, no changes allowed. ]

Exit Script [ ]

End If [ ]

And since I will never know which field the user is going to click, It looks like I will have to write a small script for every field that is selectable because I can not pass a parameter into Got to Field [ ] either. I must select a field from the pull down window. Yikes!

Any suggestions how to capture the field name dynamically ??? Can someone guide me building a function if that is a possibility ??

I sent the following to Filemaker asking them to correct the GetFieldName [ Field ] function. And to allow me to pass a variable into Go to Field [ ]

Set Variable [ $Set Field Name ; GetFieldName ( Field ) ] where Filemaker pushes the field name into "Field"

If [ Project::Project OCD = "C" ]

Show Message [ Project closed, no changes allowed. ]

Exit Script [ ]

Else

Go to Field [ $Set Field Name ]

End If [ ]

This is the way GetFieldName [ Field ] should work. Yes ??

Tom :-)

Am I missing something here ???

The minute I assign my script to the fields;

If [ Projects::Project OCD = "C" ]

Show Customer Dialog [ Message; Project closed, no changes allowed. ]

Exit Script [ ]

End If [ ]

The field does not maintain is selection status if the above statement is False.

Anyway, thank you everybody. Any ideas would be grateful.

Tom :-)

Share this post


Link to post
Share on other sites

HI,

Initially I did exactly what you sent me, thank you. And that is where my dilemma began.

I also have an OnObjectExit trigger due to the fact that these specific fields effect sales commission payouts and before the project closes any changes in these fields triggers the script that recalculate the sales commission.

Assigning a script to the field vs assigning the OnObjectEnter, the script runs before the field actually actives allowing me to validate whether or not the "C" is present of not.

With an OnObjectEnter script trigger, the fields activates first, then the OnObjectEnter script fires, then the OnObjectExit fires even if I enter a "HALT" script step in the first OnObjectEnter script to try and stop everything. But Filemaker ignore it. Huh?? ...

I guess I'll have to write a small script for every single field that effects the sales commission and hard code the Go to Field [ ] in my "Else" script step.

I sent in a request to Filemaker to make the changes to the GetFieldName [ Field ] function and to also all me to pass a variable into the Go to Field [ ] script step. But, it took from v6 to v12 to make the requested changes I wanted on other issues :-) so maybe v18 hehehehe :-) Yes?

Thank you.

Tom :-)

Share this post


Link to post
Share on other sites

Assigning a script to the field vs assigning the OnObjectEnter, the script runs before the field actually actives

Do you mean you have turned the field itself into a button? That's going to make things much more difficult for you, for two reasons: first, as you have noticed, clicking the button does not activate the field - so there is nothing the script can capture. You will have to assign a script parameter to each button specifying which field it's attached to. The other problem is that there is no Go to Field By Name[] script step; this means you need to assign an object name to each field (before turning it into a button) and use the Go to Object [ Get (ScriptParameter) ] script step instead. Altogether, it's much more work.

I also have an OnObjectExit trigger

I don't see why this should cause a "dilemma". If you don't want the script to run unnecessarily, wrap it an If [ not Locked ] clause. Or change the trigger to OnObjectModify or OnObjectValidate.

Share this post


Link to post
Share on other sites

Thank you.

The OnObject Modify is going to work great once I can determine which field was clicked.

Nothing works, absolutely nothing works until the field has the cursor in it, which defeats the whole point in not allowing access if the project is closed. If the project is not close, I still have to physically type into Go to Field in each individual script per field due to the fact that the field name is not available until the cursor is in the field even with the get object name it's the same thing. I am unable to get my information a the point of "CLICK"

Setting a script parameter doesn't capture the objects name either. I tested in a message and the message was blank until the cursor was in the field, then the object name was available.

If I have just this script:

If [ Project::Project OCD = "C" ]

Set Custom Message [ "Message" ; "Project closed, no changes allow. ]

Exit Script [ ]

End If

Filemaker cancel the point of click even if the project is not closed. All that happens is the script runs and the field is still not selected.

Frustrating.

I just can not believe that I can not get the name of my field just by clicking on it! That to me would make sense and all this time I've been working with filemaker I never needed to know the field name until now. Yet, I can not attain it! There has got to be a way to capture the field name on a click.

Thank you again.

Tom :-)

Share this post


Link to post
Share on other sites

Hi Tom,

Two things I did not see in your responses, if you could clarify please ...

Do you have entry to the field turned off (check Inspector > Data > enter in browse) or do you have a control attached (pop-up, radio button or Checkbox)? At this point it might be best for you to zip and attach your file. You can create an empty clone by File > Save As.

Share this post


Link to post
Share on other sites

The OnObject Modify is going to work great once I can determine which field was clicked.

You cannot determine which field was clicked, because there is no such field. If you have turned your fields into buttons, it's the buttons that get clicked - not the fields. I thought we have already established that.

Setting a script parameter doesn't capture the objects name either.

Again, there is nothing to capture. You must pass the actual object name as the parameter of each button.

Share this post


Link to post
Share on other sites

I just can not believe that I can not get the name of my field just by clicking on it! That to me would make sense and all this time I've been working with filemaker I never needed to know the field name until now. Yet, I can not attain it! There has got to be a way to capture the field name on a click.

But there is. The girl in the sailor suit gave you the answer already. Get ( ActiveFieldName ) . You'll be in the field to trigger onObjectEntry and to use that function, but so what? You can get out immediately with a Go to Next Field[] or a Commit[]

That will trigger the onExit but you can put some logic in the onExit to prevent any changes from occurring (like, for example, using the same test you're using in the OnObjectEntry).

Share this post


Link to post
Share on other sites

The girl in the sailor suit gave you the answer already. Get ( ActiveFieldName ) .

Well, if you are in a field, you don't need to know its name in order to get out. OTOH, if you're not, then Get ( ActiveFieldName ) will return empty.

Share this post


Link to post
Share on other sites

Hi,

Everybody seems to have missed the fact the there is no active field. I wanted to streamline my script since these eight fields had the same conditional requirement. The only thing that was different was that the user could select any one of the eight. And since I didn't know which one the user would select. I decide to pass the field name into a parameter or Get Function which would allowed me to have a nice, clean script.

Get ( ActiveFieldName ) just doesn't look very professional, that all I'm saying. Why, my value list drops down, then the message pops up. Sure I could script in some fancy if this, than that, and or maybe this or that, except under rainy skies - hehehehe. It looks sloppy and confusing to the user, come on guys and gals.

I like the fact that the field is not active when I click on it to trigger my scripts. I always error check this way before anything happens and it makes the solution smoooooooooooooooth and professional.

The way you guys are needling me, it's as if I'm suppose to except a less then marginal User Interface. Plus the OnModify doesn't work either; past the base unit of ONE digit, so if the user tries to type 11, the trigger fires. Yikes :-)

Not to sound like a moron but; what does OTOH stand for ... Over The Oily Hair. Hehehehe :-)

All I want is the field name when the user clicks on it.

So I've submitting a request to Filemaker to stop all work assigned to ALL personnel, and to completely focus on ME, my issue and correct the GetFieldName ( Field ) so it works the correct way; Get the field name, not the content of the field, that should be GetFieldContent ( Field ). And I've also requested Filemaker to change the access to Go to Field [ ] and allow me to pass the field name into to Go to Field [ ] script step.

I have to say that you guys have help me out a great deal and I also have to say that I am grateful to have access to everybodies insight. Thank you.

I ended up scripting in parameters 1 thru 8 for each of the fields and in the "ELSE" Go to Field [ ] I just ( against my better judgement ) hard coded each field name related to the script parameter.

Tom :-)

Share this post


Link to post
Share on other sites

Everybody seems to have missed the fact the there is no active field.

Perhaps you should read more carefully...

what does OTOH stand for

Google broken?

http://en.wiktionary.org/wiki/OTOH

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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