Examples of ADORs and Expressions
The following are examples of expressions, user views, ADORs, variables, functions, and so forth that were created within uPlan.
-
Retrieving Credit Card Type Information
-
Using Functions to Verify an ID Number
-
Example of a Table ADOR
-
Example of a Visibility ADOR
Retrieve Credit Card Type Information
This example defines ADORs, and makes use of user views and variables. We are interested in displaying the type of credit card used for each recipient’s joint account.
In this case, the information we need about the recipient’s credit card is not stored in the data source’s primary table. We will define a user view to retrieve the specific data.
User View "RS_JointAccountInfo"
Text ADOR "CardType" Expression
"CreditCardTypeID" Variable
After using the Wizard to create our plan, we defined a user view that retrieves data from a table called Accounts. This user view is called RS_JointAccountInfo. One of the fields we retrieved in the user view is CreditCardType, which is a number representing the type of credit card.
With the help of this user view, we defined a variable of type number called CreditCardTypeID, which uses the user view and looks at the first record of the retrieved data. From within that record, the variable is used to retrieve the CreditCardType field.
We defined a Text ADOR called CardType that uses a switch statement to match the value of the variable CreditCardTypeID with the appropriate string.
As a result, for each recipient, we can now get the credit card type for their joint account.
Use Functions to Verify an ID Number
The following is an example of a function definition, using a JavaScript function. We also illustrate the ADOR that uses this function.
Java Function that Verifies an ID Number
This example illustrates the JscriptCheckSum function, which retrieves a number and check the validation digit. This is similar to what is done for zip codes, social security numbers, and so forth.
The function adds up the numbers in the zip code, performs ‘sum modulus 10’, and then subtracts the modulus result from 10. The resulting value is referred to as the CheckSum. The function then checks to see whether the CheckSum string contains letters. If the retrieved string contains characters that are not numbers, the functions disregard the string and validation fails.
Take, for example, the zip code 12345. The function adds up the digits to get 15, then performs ‘sum modulus 10’ to get 5, and then subtracts it from 10. The returned value is 5.
The lower half of the function’s pane displays any user-defined sub-functions that are called by the main function.
Text ADOR that Uses a JscriptCheckSum Function
In this example, we also defined an ADOR, CheckSumZipByJS for the results of the function.
ADORs and the Plan Objects they Use to Verify an ID Number
Table ADOR
The following presents an example of a Table ADOR that displays two rows: the number of wine bottles and the proposed price. The first Expression window displays the Table ADOR expression, which contains only a reference to the User view in which it is defined.
Table ADOR
User View
The User View Wine Price Offers displayed in the lower Expression window, shows how this view is defined using the number of bottles (#OfBottles) and offered price (OfferedPrice).
Visibility ADOR
The following presents an example of a plan that allows certain items to be either visible or hidden, depending on the gender of the recipient.
The plan includes two visibility objects: IsMale and IsFemale. Designers using uCreate can then select the layer that includes the items to be hidden or displayed, and assign the IsMale or IsFemale ADOR to this layer or spread.
IsMale
IsFemale