Question & Answer
Question
How can I write SQL statements to include current object values like Application Group Name or user ID?
Cause
Content Manager OnDemand provides macros that can be used in SQL statements (including the query restriction) to allow the macro to be substituted by the appropriate value.
Answer
The new macros are:
Name | Description |
$ODUSERID | The user ID that is logged on to Content Manager OnDemand |
$ODALIAS | The user alias defined for the user ID that is logged on to Content Manager OnDemand |
$ODAGNAME | The application group name |
$ODAGID | The application group internal identifier |
The substitution does not include any necessary quotes for the macro, therefore you must ensure that you properly quote the macro (if required).
For example:
ODTBL.ag_field in (SELECT <column1> FROM <customer_table> where userid = '$ODUSERID')
if the user logs onto Content Manager OnDemand as USER1, the SQL becomes:
ODTBL.account in (SELECT value FROM AAA1 where userid = 'USER1')
Example for System i:
ODTBL.ACCTNO IN ( SELECT ACCOUNT FROM QGPL.SECTEST WHERE USERNAME = '$ODUSERID')
Was this topic helpful?
Document Information
Modified date:
15 November 2018
UID
swg21611495