Easy ways to update layout references

Discussion created by sreese on Oct 21, 2015
Latest reply on Oct 22, 2015 by sreese

Greetings everyone please forgive the length of this post.I don't know if others have used this methodology or not, but I am interested in getting some feed back.


I have developed a solution to my interface updating issues. Mainly find all of the scripts that may use a layout and point them to a new one without a lot of hassle. It involved a few scripts and 2 extra tables in the database, but for the ease of updating it was more than worth the minimal resources required for such a task.


These are the two tables I came up with.


To start out with I needed to be able to get the system ids and store them into the LayoutIDReference Table. With some research I was able to find out that I could get the layout names and numbers with the command LayoutNames(Get(FileName)) and LayoutIDs(Get(FileName)). I then wrote the script below to parse the data and store it into the table. (There may be a more efficient way, but this was a quick brush at it.)



The data returned from that script looks as follows:


After I had that working I created the second table.

This table contains the ID to be referenced by the scripts, the layout id (which is a drop down list that shows the names of the layouts), the name of the Window if need be, and a description field so I can remember what each one is for quickly and easily.


When I original designed this I was looking to do windows that centered in the screen and allowed a user to edit an item. So this is the script I came up with

It runs a couple of SQL queries to get the information needed to create the window and go to the correct layout. Then it will resize the current window from full screen to almost full screen and create the new window followed by going to the correct layout by calculation.


If it cannot go to the correct layout because I've renamed a layout and haven't reran the get layout names script it will perform this function automatically.


If for some reason it fails a second time it will then close the window, return the first window to its original size and display an error message to the user. When I finish it the script it will also send an email to the developer letting them know of the error.


I pass the ID parameter in this script to get the correct result from the layouts table.


So now when I wish to rework a layout I can duplicate it, make all of the needed changes, and then update the layouts table to point the scripts to the new layout number and all of the other scripts will be fixed.


I am in the process of writing a script that doesn't create a new window every time either.


Anyhow, I was pretty excited to figure this time saver out. Let me know what you think!