lucyblade Posted September 9, 2016 Posted September 9, 2016 This may seem like a strange request, but I am wanting to know if anyone has a handy way of being able to tell when a layout was last used? I ask this as I would like to delete some layouts that are no longer used but i don't want to do this if my users still need them, there have been a lot of requests for layouts showing information that I am sure are no longer needed / or haven't been used for a while.
bcooney Posted September 9, 2016 Posted September 9, 2016 You could add a logging mechanism to your navigation. Then review the logs.
lucyblade Posted September 9, 2016 Author Posted September 9, 2016 I have previously attempted something like that but I get caught in an infinite loop. On Layout Enter Set Variable [$LayoutName; Value: Get (LayoutName) Go to Layout["LayoutUseage" (LayoutUseage)] New Record/Request Set Field [LayoutUseage::Layoutname;$LayoutName] Close Window [Current Window] Go to Layout [original layout] The problem with this is, the instant I go back to the original layout the Layout Enter script fires again and I'm caught in a loop.
Steve Martino Posted September 9, 2016 Posted September 9, 2016 (edited) You need a way to turn off the trigger after it's fired. If the first step in your OnLayoutEnter script trigger is this: Freeze Window If [$$Triggers]//this should be populated on first window open with a value of 1 Set Variable....//layout name Set Variable[$$Triggers; ""] //turn trigger off so the script wont fire again with new window New window... Go to layout... New Record Request... Set Field.... Commit Records... Close Window Set Variable[$$Triggers; 1]// turn triggers back on End If If you go to the layout, the script runs. It will grab the layout and set a variable. When the new window pops up, at that point the trigger will fire, but because it's turned off it wont do anything. The script will continue, the trigger will be reset, the window will close and the user will never know Edited September 9, 2016 by Steve Martino
comment Posted September 9, 2016 Posted September 9, 2016 24 minutes ago, lucyblade said: The problem with this is, the instant I go back to the original layout the Layout Enter script fires again and I'm caught in a loop. Instead of fighting with this, why don't you sidestep the problem by triggering the script OnLayoutExit? Then your script could be simply: Set Variable [ $layoutName; Value:Get (LayoutName) ] Go to Layout [ “LayoutUseage” (LayoutUseage) ] New Record/Request Set Field [ LayoutUseage::Layoutname; $layoutName ] Exit Script [ Result: True ] Another option would be to write the log into a global field/variable, and transfer the data as part of your closing script.
lucyblade Posted September 9, 2016 Author Posted September 9, 2016 Thanks Steve Martino, this worked a treat :O)
Steve Martino Posted September 9, 2016 Posted September 9, 2016 Comments ideas are (always) better, especially writing to a global variable.
Recommended Posts
This topic is 2997 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now