User guide
The view model editor
68 Data Integration with Sybase Avaki Studio
JavaScript references:
• http://www.devguru.com/Technologies/ecmascript/quickref/javascript_intro.html
• http://www.topxml.com/javascript
Accessing columns from incoming result sets
When you connect one or more other elements to an operator in Studio, you can access
the values in the incoming result sets’ columns from expressions that you define in the
operator. For example, if you have an Input Source feeding into a Select operator, in
the Select’s “Where” field, you can refer to the Input Source’s columns. To do so, you
simply specify the column by name. You can enter column names by hand, or you can
use Studio’s expressions menu to paste them in for you. For example, the expression
you enter for the “Where” field might be COLOR == "Red" if “COLOR” is the name
of a column in the Input Source’s schema.
If an operator has more than one input feeding into it, you must qualify the name of the
column using the name of the upstream element. For example, if you have an Iterator
operator which has inputs from “Aggregate1” and “Aggregate2,” refer to the “Total”
column from the first input as Aggregate1.Total and the “Total” column from the
second input as Aggregate2.Total.
Advanced Users In the case of the Custom operator (where you cannot use the
simple column name), or if, for some reason, you cannot uniquely refer to a col-
umn by its name in another type of operator (perhaps the column name is not a
valid variable name or two columns have the same name), you can use the acces-
sor methods in the ResultSet class to access the columns by their position. The
result sets are in variables named after the incoming element’s name with the suf-
fix “RS” appended. For example, in the Iterator example above, there would be
two result set variables accessible, named Aggregate1RS and Aggregate2RS.
In addition, Avaki provides a set of utility functions you can call to ensure that
null values are properly handled. See “Result set accessors” on page 73 for
details.
Accessing global parameters
The view model parameters you’ve defined for your model can be referenced in the
form variables.global.<globalName>. You can use Studio’s expressions menu
to insert references to global parameters into your expressions. See “The expressions
menu” on page 71 for details on using the expressions menu.