Tuesday, March 17, 2009

Ispredefined Constant ?

Whenever you drag a Constant operator into your OWB mapping and define a constant , there is a check box with "Ispredefined Constant" under the attribute properties. What is "Ispredefined Constant"?

This topic is covered on lot of forums and blogs but i would like to go over it again.

I find two good uses of it.
1) On generation of OWB code for any mapping , constants are generated by OWB like
get_model_name (name of the mapping)
get_selected (number of rows selected)
get_inserted (number of rows inserted)
get_updated (number of rows updated)
etc..




















These constants can be used within your mappings to get value at runtime.


For eg: If you are trying to get mapping name you can use the "get_model_name" in the expression value of the constant with Ispredefined checkbox checked. Make sure you do NOT put single quotes around the expression value.
























2) Whenever you declare a constant in OWB mappings make sure you always check the Ispredefined constant checkbox, this helps whenever you are testing your mappings by generating intermediate code.

If you do not have Ispredefined Constant checked, OWB generates some internally generated name instead of expression value.

With Ispredefined constant set the expression value is subsititued automatically



















Note: OWB 10.2.0.4 generates the right intermediate code without needing to check the Ispredefined Constant checkbox.



1 comment:

  1. Hey Suraj,
    Great blog - saved a lot of time.
    Thanks for sharing.

    ReplyDelete