User guide
Operator reference
114 Data Integration with Sybase Avaki Studio
Note The Custom operator is an exception to the guidelines regarding Java-
Script expressions in that you must always access the columns of both incoming
and output result sets using either the accessor methods on the ResultSet
object itself or the Avaki utility functions (as listed under “Avaki Functions” on
page 73).
Example: Making a lookup table using a Custom operator and a .jsi file
The problem
Suppose you have an input source—a database operation, for example—that returns a
result set of transaction data. Unfortunately, the prices in this data are in various cur-
rencies, and you need to express the prices in Euros. You have another input result set
that has information about current Euro conversion rates.
The columns in the first input result set are:
— ACCT_NO - the account number for the transaction
— SYMBOL - the symbol of the stock purchased
— NO_OF_SHARES - the number of shares of stock purchased
— COST - the cost per share
— CURRENCY - the currency in which COST is expressed
The columns in the second input result set are:
— CURRENCY - the currency for which the conversion factor applies
— MULTIPLIER - the factor by which the original value is multiplied to get the
Euro value
Your goal is to produce a result set consisting of:
— ACCT_NO - the account number for the transaction
— SYMBOL - the symbol of the stock purchased
— COST_IN_EURO - the cost in Euros of the transaction
One possible solution
One way to produce the result that you need (and probably the most straightforward
way to use Studio) would be to use a Join operator, employing the “Inner Loop Join”