This is just a quick tutorial to show you how to add more global variables or global strings to a DRS. These globals are useful because they're acessible via the Edit Settings window, which means that people not comfortable with the code can quickly and easily view and modify them (e.g., the "ReferenceStandard" global string). These globals are given a default setting in the header of the DRS, which is used every time a new experiment is opened. If a user decides that they don't want to change the setting in the experiment they're working in then they do this via the "Edit Settings" window.
Below is an image of the header text in the Trace_Elements DRS.
To add a new global is pretty straightforward. First, you need to make a new line in the DRS header - the easiest way to do this is to copy an existing line of the header. Pick a GlobalVariable if you want to store a number, or GlobalString if you want to store text (in most cases you'll want to use a variable).
Put the newly copied line directly beneath the line that says "//**** Any global strings or variables you wish to use in addition to those above can be placed here", like this:
Now change the name to what you'd like to use (make sure it doesn't start with a number, isn't more than 30 characters long, and contains no spaces or special characters), and input your default value (or string):
Now we're done with the header text, and for the next step you'll need to look a little lower in the DRS for these lines:All you need to do here is add your item to the "NVar" list if it's a GlobalVariable, or the "SVar" list if it's a Global String. Make sure you add a comma prior to your item, and that the name is identical to what you put in the line above (copy and paste is the best way to ensure this). Here's my example added to the list of variables:
Now you're all done. To use the global variable within the DRS just use it like a normal variable, e.g.:Just note that for the change to take effect in any existing experiments you have you'll need to go to the Iolite menu and choose "Update old experiment" so that the new global gets detected by the system.
And remember, if you want to change the setting for your global, you should do this via the Edit Settings window. The header of the DRS stores the default value, which will only be read in at the beginning of a new experiment.
If you have any questions then just post a question on the forum.