This content has been marked as final. Show 5 replies
Sounds ur block is single record for search input then u need to use...
To_Char or To_number if u Will compare 2 items then same datatype is needed for comparison otherwise write each in separate statement.
Since i don't know what is ur datatype is then u have to decide .
the following is just an example...
WHEN NEW BLOCK INSTANCE or PRE BLOCK Trigger block level
Another idea is to use set_item_instance_property with navigable set to FALSE look for it inform on line help
IF :CUSTOMERS_NAME OR :CUSTOMERS_code IS NULL THEN set_item_instance_property('block_name.button_name',enabaled,property_off); ELSIF ....... set_item_instance_property('block_name.button_name',enabaled,property_on); END IF;
Your code doesn't make sense to me.
-- customer numberWhy are you trying to set CUSTOMER_NUMBER enabled if it is not null? It stands to reason that if the field has a value entered in it, then it is ENABLED. You do this with the CUSTOMER_NAME field also. Your search fields should always be enabled unless they are dependent on one another.
IF customer_ number is not null then
elsif customer_ number is null and customer_ name is null
this create a problem when i entered the data it works fine but when i remove the data in both the field, after control goes to some other area of the form then only find button gets disable.I think your best option would be to enable/disable your Search button in the QUERY_FIND block's When-New-Item-Instance trigger. Something like:
Keep in mind that when you enable an item that was disabled, you have to set the NAVIGABLE, UPDATE_NULL, and UPDATABLE properties to TRUE also. In your case, since you are enabling a button, you would just need to set the ENABLED and NAVIGABLE properties to TRUE.
/* Sample When-New-Item-Instance trigger */ BEGIN IF ( :QUERY_FIND.CUSTOMER_NAME IS NULL AND :QUERY_FIND.CUSTOMER_NUMBER IS NULL ) THEN Set_Item_Property('QUERY_FIND.SEARCH_BTN', ENABLED, PROPERTY_FALSE); ELSE Set_Item_Property('QUERY_FIND.SEARCH_BTN', ENABLED, PROPERTY_TRUE); Set_Item_Property('QUERY_FIND.SEARCH_BTN', NAVIGABLE, PROPERTY_TRUE); END IF; END;
If you need Forms to respond while the event is happening (such as you want the button to enable as soon as a user starts typing in a field) then you would need to use a 3rd party Java Bean (such as the KeyEvent Java Bean) or develop your own.
Hope this helps.
Your code sample isn't even valid syntax! There is no "ENABLED" property for the SET_ITEM_INSTANCE_PROPERTY built-in and the CONSTANT is PROPERTY_FALSE or PROPERTY_TRUE not OFF/ON!
IF :CUSTOMERS_NAME OR :CUSTOMERS_code IS NULL THEN