2 Replies Latest reply on Nov 16, 2014 5:34 AM by RyanRivkin

    want to go back to original field/tab

    RyanRivkin

      Title

      want to go back to original field/tab

      Post

      Hey everyone, so I just rolled my own audit log and its working great, except, every time the script runs it leaves me in the audit field witch is on its own tab. How do I get FM to leave me on the tab that I was in before field verification ran the script on field exit. 

      Screen_Shot_2014-11-14_at_7.59.14_PM.png

        • 1. Re: want to go back to original field/tab
          philmodjunk

          It would help to see your script so we know why a different tab panel becomes the front tab panel. It may be possible to change that script such that the current tab panel stays in front, it may be necessary to include a go to object or go to field step to put the focus back into the tab panel that was in front when the script was first performed.

          To post a script to the forum:

                 
          1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
          2.      
          3. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
          4.      
          5. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
          • 2. Re: want to go back to original field/tab
            RyanRivkin

            All objects have a script trigger on object enter that runs this first script, just to grab the current contents. except images and signature fields.

            Script Triggers: Trigger | Set current contents

            #this script merely grabs the current fields contents adn sets teh global variable with it.

            Set Variable [ $$oldcontents; Value:Get ( ActiveFieldContents ) ]

            Then all object have another script trigger for verification that runs this script. 

            Script Triggers: Trigger | Audit Trail

            #this will run when any changes are attempted to be made to an item. and will enter them into an audit trail

            Set Error Capture [ On ] 
            Freeze Window
            Set Variable [ $afn; Value:Get ( ActiveFieldName ) ]
            Set Variable [ $afc; Value:Get ( ActiveFieldContents ) ]
            Set Variable [ $aon; Value:Get ( ActiveLayoutObjectName ) ]
            #script triggers can be: nottext ; recordview ; if nothign script assums field edit #nottext used for field that are not text based
            #recordview used for when a record is viewed
            Insert Calculated Result [ Assets::Audit Trail; Case ( Get ( ScriptParameter ) = "" ; ¶ & Get ( CurrentTimeStamp ) & " " & Get
            ( AccountName ) & " changed " & $afn & " from:" & $$oldcontents & " to:" & $afc ; Get ( ScriptParameter ) = "nottext" ; ¶ & Get ( CurrentTimeStamp ) & " " & Get ( AccountName ) & " changed " & $afn ; Get ( ScriptParameter ) = "recordview" ; ¶ & Get
            ( CurrentTimeStamp ) & " " & Get ( AccountName ) & " viewed this record " ) ] 

            And it works fine, until the script ends then I'm dropped on the audit tab with the audit field active and editable. but i just want to be left where i was editing with this to run in the background away from the user. am I going to have to put the audit field on its own layout?