Jump to content

Layout Use Frequency


lucyblade

This topic is 2782 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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 by Steve Martino
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 2782 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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