Forum Stats

  • 3,817,231 Users
  • 2,259,293 Discussions
  • 7,893,705 Comments

Discussions

disableing an item in enter query mode

622131
622131 Member Posts: 40
edited Aug 29, 2008 7:29AM in Forms
Hello experts,
i want that a perticular item will be disabled after you press enter button of query menu.(or query->enter).Can any body please tell me what is the actual trigger in which i write the disable statement.

set_item_property('itemname', enabled, property_false);


Regards
Anutosh
Tagged:

Best Answer

  • 611407
    611407 Member Posts: 418
    Answer ✓
    My main suggestion is that you read what people write. The code for the key-entqry trigger does not contain
    if :system.mode = 'ENTER-QUERY' then
    because you are not in enter-query mode at that point. This was only required in the when-new-record-instance trigger but, as I wrote before, that code sample will not work.

    The solution is already here. I'm out.
«1

Answers

  • 611407
    611407 Member Posts: 418
    edited Aug 28, 2008 6:02AM
    If you want to prevent a user entering data in a feld when they do a query, set the item's Query Allowed property for No.

    Otherwise, the trigger you're looking for is key-entqry.
  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    If you want to prevent the item from being queried you can set the "Query Allowed" property to "No" in the item's property palette.

    If you want to do it programatically you can use the SET_ITEM_PROPERTY('item_name', QUERY_ALLOWED, PROPERTY_FALSE);
    But remember to set it back when you cancel or exit the enter-query mode.

    Tony
  • 622131
    622131 Member Posts: 40
    Hello everybody,
    I want to disable the perticular item when i press enter query but it is showing FRM 41032 can not ENABLE attribute of current item.

    I have written this code in KEY-ENTQRY trigger

    set_item_property('EMPNO', enabled, property_false);

    can any one please suggest.

    Regards
    Anutosh
  • 622131
    622131 Member Posts: 40
    Hello everybody,
    I want to disable the perticular item when i press enter query but it is showing FRM 41032 can not ENABLE attribute of current item.

    I have written this code in KEY-ENTQRY trigger

    set_item_property('EMPNO', enabled, property_false);

    can any one please suggest.

    Regards
    Anutosh
  • 622131
    622131 Member Posts: 40
    hello experts,
    i want to disable some perticular items when the form moves into enter query mode, in the trigger

    KEY-ENTQRY

    i have written this statement

    set_item_property('EMPNO', enabled, property_false);

    but it is not working .can any body suggest what can i do.

    Regards
    Anutosh
  • 622131
    622131 Member Posts: 40
    hello experts,
    i want to disable some perticular items when the form moves into enter query mode, in the trigger

    KEY-ENTQRY

    i have written this statement

    set_item_property('EMPNO', enabled, property_false);

    but it is not working .can any body suggest what can i do.

    Regards
    Anutosh
  • Tony Garabedian
    Tony Garabedian Member Posts: 3,375
    edited Aug 28, 2008 10:45AM
    user619128 wrote:
    hello experts,
    i want to disable some perticular items when the form moves into enter query mode, in the trigger

    KEY-ENTQRY

    i have written this statement

    set_item_property('EMPNO', enabled, property_false);

    but it is not working .can any body suggest what can i do.
    what do you mean by it's not working??? are you getting an error???
    Like I said in my previous post, you can set the item's property false for "Query Allowed" this will not allow the user to use this item as a query item.


    Tony

    Edited by: Tony Garabedian on Aug 28, 2008 5:44 PM
  • 622131
    622131 Member Posts: 40
    edited Aug 28, 2008 10:48AM
    Hi tony,
    Thanks for the reply .I am not getting error when i am using the

    set_item_property('EMPNO', enabled, property_false);
    or
    set_item_property('EMPNO', QUERY_ALLOWED, property_false);

    but the error is that even after writing such kind of code in the run time when i am in enter query mode , i am able to insert char or number inside the empno field.

    That is the problem it is behaving like it is not disabled.

    I think now i am clear.

    Regards
    Anutosh

    Edited by: user619128 on Aug 28, 2008 7:44 AM
  • 611407
    611407 Member Posts: 418
    edited Aug 28, 2008 7:47PM
    You can't set the enabled property if the cursor is in the item and I expect it's the same for the query_allowed property. if the cursor is in the item which you set to Query_Allowed=false and then you go to enter-query mode, perhaps forms doesn't know what item to move the cursor to, so just leaves it where it is.

    You can solve the problem by moving to a different item (with go_item) before setting the property.

    When do you need to set the item back to enabled? If you want it enabled at all times other than when a query is being entered then use the Property Pallet to set the Query Allowed property. If you want to disable the field under certain conditions then the when-new-record-instance trigger might be better for you. Eg
    if :system.mode = 'ENTER-QUERY' and <condition> then
      go_item(<another item>);
      set_item_property(<item>, enabled, property_false);
    else
      set_item_property(<item>, enabled, property_true);
      set_item_property(<item>, update_allowed, property_true);
      set_item_property(<item>, navigable, property_true);
      set_item_property(<item>, update_null, property_true);
    end if;
    It might be better to set the query_allowed property instead of the enabled property, but I can't check right now whether that's possible after the enter-query mode has begun.

    The update_allowed, update_null and navigable properties are all set to false as a consequence of the enabled property being set to false. If they should be true then you need to reset them after reenabling the item.
  • 622131
    622131 Member Posts: 40
    hi u3,
    Thank you very much for your reply.can you please tell me the name of the smart trigger in which i should write the codes.

    currently i am using the KEY-ENTQRY trigger.please suggest correct trigger if it is wrong one.


    Regards
    Anutosh
This discussion has been closed.