Cleaning up Property Names

Conventions for property names within Pipeline Pilot protocols and methods for  dealing with properties not following these conventions in PilotScript is summarized in the following text from the online documentation at

Help->Server Home Page->Help Center (User Resources)->PilotScript->Getting Started with PilotScript:

"Property  names can only contain alphanumeric characters  (A-Z, 0-9) and underscores ( _ ), and must start with an  alphabetic character or underscore. Property names  that do not follow these rules can be qualified using the Property() function, or with a percent sign (%) followed by the  property name enclosed in single quotes. For example, Property('a'),  %'arf bark'."

I thought some people may find a general component for converting property names to adhere to the above convention useful when they don't want to use the Property() function or the %' ' shorthand extensively in all of their PilotScript components.  Please see the attached protocol, which contains a "Clean Up Property Names" component.  This component performs the following manipulations on your property names:

1. Trims any leading and/or trailing whitespace.

2. Prepends an underscore if the property name starts with a number.

3. Replaces non-word characters (characters that are neither alphanumeric or an underscore) with an underscore.

4. Stores the original and new property names as keys and values in a global hash (@__PropNamesHash__), respectively.

If you want to replace certain characters with something other than an underscore, provide these characters as a comma-separated list on the Custom Character List parameter.  Then provide a comma-separated list of your own replacement tokens (these can be single characters or longer strings) on the Custom Replacement List parameter.  Note that the lists specified on these two parameters must contain the same number of items.

The protocol also contains a "Recover Original Property Names" component that restores the original property names.  This component can be used at the end of your protocol before displaying output or saving results to files.

If you find these components useful, you can save them to your xmldb for later re-use by right-clicking on the component and choosing "Save As..."

PS this is something I've just contributed on my own to the community forums.  No official support or promised functionality by Accelrys is implied.