Support and Training

Removing Text Via MetaScript

There may be a scenario where you would like to display some information already contained in a field but is included with other information you do not want to display. For example, suppose you would like to display the name of the sales rep on a Quote Print form you send your customers. The Sales Rep name information is contained in the Employee_2_Name field in the Estimates-Quotes folder type but the field also includes the employee number information in the following format [10] Joe Smith. Using the MetaScript String Split function, you can drop the employee number information by identifying a character ( ] ) which it will be easy to split the value into two different items. Then you can choose to display the information after the splitting character. 

The script example below provides an example for solving this scenario.

    1. Place the field, "Employee 2 Name" out of view on your Quote form.
    2. Add a Variable field to the form. In the Calculate As section of the field properties, enter the following script:
var a = Field( 'Employee 2 Name' ).toString(); 
var b = a.split("]", 2); 


           3. Save the form and text. 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request