Tips & Tricks: Creating a Field List Variable

Do you ever end up with your results in a table with more fields than necessary, or the fields are in an illogical order? Here is a simple solution…

An easy way to control the order the fields is to use a variable to define the fields. Create a script to define the variable. Make the variable name something that is easy to identify, such as v_FieldList. Use the ASSIGN command to define the variable with the fields that you want to see in your results, and in the order that makes sense for your results. The picture below provides an example of the script to define the field list variable, and extract these fields to a table.

It is important to remember to enclose the list of fields in (“ ”) double quotes. When the results are extracted to another table, the fields will be put in the order specified in the variable. This makes it easy to change the order of the fields and maintain consistency across multiple results from the same table.

FieldList