April 10, 200718 yr Newbies I thought I was quite good at problem solving but this one has me whacked… I’m trying to write a script whereby I can refer to “the current field” without using its specific name. The database is a school report for each student in which teachers will put “ticks” in fieldA, fieldB, fieldC etc by clicking on the relevant fields. So a simple script would be: Allow user abort [Off] Set error capture [On] Insert text [select; S1 Reports::FieldA; ü] # “ü” in “Wingdings” font converts to a “tick”. However, this means I have to write individual scripts for each field. Is there no way of introducing the equivalent of a “CurrentField” variable or some other solution to this? Thanks for your help. :(
April 10, 200718 yr What exactly is each of the relevant fields... it sounds like you might be better dumping this in a related structure but hard to tell when you give examples like "fieldA", "fieldB", "fieldC" etc.
April 10, 200718 yr If you use set field [] or other script steps that ask you to specify a field, you can leave that part blank and not specify one. Then the script step will act on the currently active field. You can script moving through fields on a layout to iterate through all the fields you want. I have attached an example file. test.fp7.zip
April 10, 200718 yr Author Newbies Thanks for this. It allows me to identify the field alright but I'd have to write individual scripts for each field I want to insert a tick into.. I take genx's point that I'm not making myself very clear so I'm attaching the file to let you see the kind of thing I mean... Thanks again. Copy_of_S1_Reports.zip
April 11, 200718 yr The only way I know to run a script immediately upon entering a field is to use a plugin. I've attached a solution that uses such a plugin along with the plugin file. Eventscript is a free plugin and the readme file is included in the attachment. I excluded the demo files to save on attachment size but included a modified version of your file with the plugin function calls inserted. You'll have to place the plugin file in the extensions folder of filemaker for the solution to work, and you'll have to be logged into the test account for the validation trigger to be active. (This is the default account now) Now when you click in an empty field, the check mark is inserted, and when you click in a non-empty field the field is cleared. Let me know if you have trouble getting this to work. Dana EventScript_v1_1_ForWindows.zip
April 11, 200718 yr Here is a slightly modified version of the file that will only run the script if the field clicked into starts with the characters "AD_S1" Another option for this of course is to just make each of these fields into native checkbox fields and have users check and uncheck the fields that way. Copy_of_S1_Reports.fp7.zip
April 11, 200718 yr Author Newbies Works a treat! So grateful because that has saved me hours of low level scripting. Thanks too for the second idea of narrowing the application of the script - that should come in handy too. Cheers! Stuart
Create an account or sign in to comment