Nav view search

Navigation

Search

Knowledge Base

Technical tips, helpful recommendations, pointers and fixes.

Back

MetaScript Example - Making and Reusing Static Lists

2009-06-04

Bookmark and Share Share

This article provides examples of making static lists using MetaScript arrays.

Using a MetaScript array, a list of items can be generated one time and the list reused across your Virtual Ticket or Digital Storage Manager forms. The script is easy to write and can save the time spent manually entering the values, much in the same way a dynamic popup list works.


To create a static list of values using an array, perform the following: 

  1. Open a desired form in the forms editor and choose Global MetaScript from the Format menu.
  2. Enter the following script into the Global MetaScript window:
    function 
    getList() 
    var myList = new Array("Joe""Steve""Bob""Sally""Mike"); 
    return myList; 
  1. Close the MetaScript window to save your script.
  2. Place a popup field onto your form. Click the Value arrow and choose Custom.
  3. Enter getList(); into the expression window.
  4. Save your form and test.


To use this item across multiple forms:

  1. Open a text editor and copy and paste the script into the text file.
  2. Save the file with a .js extension. Drag and drop the file into the Stored Scripts area of the Setup menu (DSM - Administration Menu).
  3. For each form which the script should be used on, enter the following in the Global MetaScript window to reference the Stored Script:
    //@include "database:yourscripts.js" 

    This statement tells the application to use scripts from the yourscripts.js file which has been added to the database.

    Repeat step 5 from the previous section to specify the function to be used in your popup menus.