Tips and Tricks
How to search for multiple objects
Sometimes you may need to search for instances of different business object based on the values of attributes common to all of them. For example, let us assume you have defined SavingAccount and CreditAccount objects. Both objects contain different attributes and yet both of them have the Balance attribute defined. Suppose you want to find all accounts (saving and credit) with the balance greater than 1000 dollars.
The solution is to add both objects to a business group (called Account, for example) – see the “Adding/Editing Business Object Groups” section – and define a query that will look for the business object group rather than an individual business object (see the “Adding/Editing Queries” section).
What to do if an object can be related to multiple objects
Sometimes when you define relationships between business objects you may want to establish a relationship with different business object through the same reference attribute. For example, let us assume that you are defining an Account object and you want to establish a relationship between the account and its transactions by defining the MyTransactions reference attribute. However, you have several business objects that represent transactions – WithdrawalTransaction and DepositTransaction. These transactions have some different attributes and some common attributes (for example Amount).
The solution is to add different objects representing transactions into a business object group (called Transaction, for example) - see the “Adding/Editing Business Object Groups” section – and get the reference attribute to refer to a business object group rather than the individual business object (see the “Setting Properties of Reference Attributes” section).
How to display currency symbol
If some attribute of a business object represents currency, then you may want to display the value of the attribute with the currency symbol in front of the value – for example, $400. To do this define the attribute to be of the Number type and add the currency symbol to the format of the number – for example, “$#” - see “Attributes of Number Type”, Appendix C. The value of the attribute will be displayed with the currency symbol on all forms. If you want to display the currency symbol only in certain reports or presentations, you should not change the format of the attribute, but instead include the currency symbol inside the tags of the reports or presentations, for example:
<<Account.Balance, $#.00>>
How to generate unique ID for the attribute
In many cases it is necessary to have a number uniquely identifying business elements, such as customer number, order number, account number, etc. If you have no particular requirements on the numbering of your objects you can simply use the ID attribute.
If you need to control the numbering of your business objects you will need to configure the attribute for this purpose of the Number type and mark it as “auto-incremented”
How to compare strings ignoring case
Use TO_LOWER_CASE or TO_UPPER_CASE functions to convert both strings to upper or lower case and then compare them. See also the “Text Functions” section.