Here's how to do that. (Thanks for guidance from Robert Adlington, SAP/Sybase Technical Publications Manager).
- Open the XDB file (Oracle used in this case)
- Navigate to root:Profile\Index.
- Right click Index in the navigation column and select New->Event Handler.
- Select Initialize from the drop-down list
- In the Event Handler Script tab, enter your custom code: I use:
obj.SetNameAndCode obj.parent.name + " Index", Left(obj.parent.code, 24) + "_IDX"
The first index will have suffix _IDX and the second will have _IDX2, with the number incrementing for each additional index.
The SetNameAndCode method applies any naming conventions and also verifies uniqueness - hence the incrementing suffix. I can’t make the first index end in 1, but you may be able to enhance the script to do so if it is important to you. [Rober Adlington]
If you use name to code conversions, the abbreviations from your conversion table will be picked up automatically in the index's code. However, if you use a different abbreviation for Index than IDX, you will need to change the code entered into the Event Handler Script tab to use that instead.
Unfortunately, I don't know how to get the conversion table's abbreviations to be picked up automatically in that script (yet!) If someone knows how to do that, please let all of us know with your added comment.
No comments:
Post a Comment