[Working with scripts]: Variables with Spaces

When working with data records, Elixir tools make the fields of the current record available to scripts. For example, if a record has fields named “DailyRate” and “DaysWorked” you can reference these directly:

=Code Snippet=
var amount = DailyRate * DaysWorked;

However, if the fields contain spaces, for example “Daily Rate” and “Days Worked”, you cannot access them directly because the names do not conform to JavaScript syntax. The same is true for fields like 2005 - it isn’t a valid JavaScript name.

In order to access these fields, you can use the JavaScript indexing ability - by using square brackets you can access any variables, regardless of their name. For example:

=Code Snippet=
var amount = this["Daily Rate"] * this["Days Worked"];