User guide
Data Integration with Sybase Avaki Studio 67
Using expressions within Avaki Studio
• CurrentUser.isMemberOf("myDomain", "DefaultAuthService",
"Grid", "Administrators")
Check to see if the user executing the data service is a member of the Administra-
tors group.
Complex expressions
Certain expression fields in Studio accept more complex expressions. These can span
multiple lines and can contain multiple simpler expressions, each ending with a semi-
colon character (;). These are generally used in the more advanced operators, such as
Iterator, Generator, and Custom.
Here’s an example of a complex expression; it comes from the Increment field of an
Iterator operator:
globals.Iterator03.counter++;
globals.Iterator03.currentZipCode =
zipcodes[globals.Iterator03.counter];
globals.Iterator03.currentState =
getStateForZipCode(globals.Iterator03.currentZipCode);
This expression consists of three separate statements that increment a variable and
then use it to determine the values for two other variables. (Note that the variable “zip-
codes,” an array, and the function “getStateForZipCode” are not defined directly
within the expression.)
Expressions and JavaScript
The expressions used within Studio are written in JavaScript. Don’t worry if you don’t
know JavaScript. As you can see from the examples above, most of the expressions
you will need to create are simple enough that knowledge of JavaScript is unnecessary.
When your models begin requiring the more advanced features of Studio, however,
you may need to better understand JavaScript and how it works. JavaScript is a power-
ful and flexible tool. The links below point to resources to help you acquaint yourself
with the basics.
JavaScript resources
JavaScript tutorial:
• http://www.wdvl.com/Authoring/JavaScript/Tutorial/
JavaScript expression tester:
• http://www.arachnoid.com/javascript/interactiveJavaScript.html