April 7, 200520 yr Hi. I'm not sure if this is the correct forum for this but here goes... I have an Invoice Status field which the user can change by means of a dropdown box. What I need to do, is to write to a log file every time the user chooses a new status. How do I do this? I've been trying out a test script (I set the field as a button which performs the script) as follows... P.S. I'm fairly sure this can be solved by obtaining a plug-in but is there a way of doing it programmatically? Allow User Abort(Off) Go To Field[select/Perform, "Status"] # add to log file using the new value of the "Status" field Exit Script However, when trying to add the new status value to the log it doesn't work. It applies the addition to the log using the old value of the "Status" field and not the new value (i.e. if the user is changing the Status from "Awaiting Payment" to "Paid", then the value added to the log is "Awaiting Payment" and not "Paid"). Anyone have an idea how I could accomplish this?
April 7, 200520 yr Try adding an Exit Record step after the user has entered the new status, but before the logging step.
April 7, 200520 yr Author Hi. Thanks for the reply. I did try adding an Exit Record step but what happens is that it adds the entry to the log as usual but doesn't allow the user to access the dropdown list contents at all (i.e user can't change the status at all)
April 7, 200520 yr This is a Windows only device, so I am merely guessing: Allow User Abort(Off) Go To Field[select/Perform, "Status"] Pause Script # add to log file using the new value of the "Status" field
April 7, 200520 yr You need a loop to wait for a new value. I think your script happens to fast as it is now before the user has a chance to select a new value . Set Field [ global ; Status ] Loop Exit Loop If [ Status (not equal to symbol) global ] Go to Field [ Status ] Pause/Resume [ Duration (seconds): 1 ] End Loop # Add the rest of your script after that to do what you need with the new value
April 7, 200520 yr With Windows and pop-up Menu you don't need (or want) a loop. You're real close but the Commit is required also. I assume you also don't want to write to the log if they make the SAME selection? This will exit the pop-up if they don't make a different selection ... Create a global text field gHold Allow User Abort [ Off ] Set Field [ gHold; Status ] Go To Field [ Select/Perform; Status ] Pause/Resume Script [ Duration (seconds): 1 ] Commit Record/Requests [] If [ Status = gHold ] Exit Script End If .... do your thing here .... I use this a lot with pop-ups and it works perfectly on Windows.
April 7, 200520 yr Author Thanks for that guys. Adding in the time delay of one second seemed to do the trick!!
April 7, 200520 yr LaRetta, For sake of knowledge. What if the user doesn't make a new selection within that 1 second pause. On Commit the field would still contain the old value wouldn't. I guess if you click on the field to begin with you knew what you were changing it to. Just a thought.
April 7, 200520 yr "What if the user doesn't make a new selection within that 1 second pause. " The great thing about pop-up Menu (on Windows anyway) is that the pop-up will stay open until a selection is made. Only then will the script continue. I've used a similar method whereby the script should only act if a change has been made (sometimes Users pop it but change their minds) and if the value change test isn't there, the script would act when unwanted. When I just want to make sure they made a selection, I use an If[isEmpty()] test instead.
April 7, 200520 yr First, thanks for this solution, this has been driving me nuts for a while. Second, what an ugly way to have develop yet another workaround. I'm guessing they just got lucky that Windows will pause everything else until the pop-up menu loses focus. A check box for "Perform script on selection" should have been added to the Pop-up Menu (lets not leave out Pop-up list & Check Box set) a long time ago.
April 8, 200520 yr How about using one of the 'audit tracking' methods which will monitor whichever fields you specify and automatically log any changes? (I don't mean to offend anyone by listing specific sample files by name and/or developer. The examples I have here are just those that I can find in my 'favorites' filemaker downloads. There are many more...) CobaltSky has one on his site for fm7: http://www.nightwing.com.au/FileMaker/demos7/demo702.html and one for fm5/6: http://www.nightwing.com.au/FileMaker/demos6.html#d1 There's the CNSAudit plugin: http://www.fmpro.org/news/227698259156/ Excelisys systems has a white paper: http://www.excelisys.com/services/fmp7/tips_tricks.htm Our own UGO has a sample file in the samples forum: http://www.fmforums.com/threads/showflat.php?Cat=0&Number=91448&an=0&page=7#91448 These should give you plenty of ideas.. Abbe
April 8, 200520 yr Here's another option: There is a free plugin at www.costello_ryan.tripod.com that works with versions 5-6. You can run a script as the user exists the field. Steve
Create an account or sign in to comment