[ Forms10g2 ] Default item value in Enter-Query mode

Hello!
How could I specify default value for an item in Enter-Query mode? E.g. I press KEY-ENTQRY, and :L_YEAR item gots current year as a default search condition (though it may change). I've tried to implement it this way:
<pre>
Enter-Query;
:l_year := extract(year from sysdate);
</pre>
This work in a rather awkward way. If I run this once (e.g. as a result of a hotkey press), it just enters Enter-Query mode, but if I run this twice (by pressing hotkey second time) it fills :year variable and does search with it as a search condition! Then, I've tried to go straight and wrote:
<pre>
Enter-Query;
:l_year := extract(year from sysdate);
Enter-Query;
:l_year := extract(year from sysdate);
</pre>
Well, this didn't work. And SYNCRONIZE call before the second Enter-Query didn't help either. So, my questions are: 1) how can I achieve needed behaviour? 2) What's going on in my experiments? Why :L_YEAR gets assigned on second keypress (as in first experiment) but not on second subsequent call (as in second experiment)?
Thanks in advance!

I don't know why that won't work but I have something which might:
when-new-record-instance trigger:
if :system.mode = 'ENTER-QUERY' then
  :l_year := extract(year from sysdate);
end if;It's always best to use both the block and item names...:block.l_year

Similar Messages

  • Initial Value in Enter Query Mode

    Hi Everyone,
    If you ever need to set a "visual" default (or initial) value for an item in Enter-Query mode, here is one solution to accomplish this:
    Create a WHEN-NEW-ITEM-INSTANCE trigger at the block level where the item is located. Make sure it can fire in Enter-Query mode.
    WHEN-NEW-ITEM-INSTANCE
    If :system.mode = 'ENTER-QUERY' AND :system.cursor_item = <YourItemName> AND <YourItemName> IS NULL Then
        <YourItemName> := <TheInitialValue>;
    End If;You may wish to play with the "Keep Cursor Position" property of the item should you want the cursor to go back to the item position it was when the item was left.

    It seems that your solution described solves my problem expressed 2 months ago....
    I'll try it out....
    Thanks......
    Sim

  • Non-Database items in enter-query mode

    I have a form with 2 base table blocks, typical master details situation. I wish to allow a field from the detail block to be queryable from the master block. I was considering adding a non-database item to the master block (visible only when in Enter-Query mode). In a pre-query trigger I would amend the DEFAULT-WHERE property of the master block when the appropriate where clause using the non-database item value. My prototype/test version works fine except the non-database item is not enabled while the master block is in enter-query mode.
    I think basically forms will enable only field s if they are database items and queryable set to yes. There are no more database items I can use to set the non-database item column name property.
    Any suggestions would be appreciated.
    Ralph
    Oracle Developer - Unisys Australia

    Hi Ralph,
    we have several Forms using non-database items as query-items which works fine.
    What we did is following:
    1) create non-database item xy in master-data-block
    2) set property database item to no
    3) set property query allowed to yes
    4) create a pre-query trigger on master-data-block where we change the where-clause (this is forms6i, in 9i we would use the one-time-where-clause)
    Peter

  • Change Value of Veriables in Enter-Query mode

    hi all
    I have made a search utility on a table, there is reqirement that in the enter-query mode the user can enter any combination of character, in simple words there is requirement of %% at begining and at end of desired search field.
    as :system.last_query gives the value like
    SELECT ROWID,SEQ_NUM,TAG
    FROM sequel1.sequelsql WHERE ( UPPER(TAG) LIKE :1 and (TAG LIKE :2 or TAG LIKE :3)) order by TAG
    how to pad % sign in the veriables :1,:2 and :3 as need to search
    tag like ('%ASSESSMENT%')
    thanks in advance

    SELECT ROWID,SEQ_NUM,TAG
    FROM sequel1.sequelsql WHERE ( UPPER(TAG) LIKE :1 and (TAG LIKE :2 or TAG LIKE :3)) order by TAG
    1.
    have you tried to handle the items contents in a PRE-QUERY trigger ?
    If blk.item IS NOT NULL Then
       :blk.item := '%' || :blk.item || '%' ;
    End if ;2.
    You could change the WHERE clause (or the ONETIME_WHERE)
    in your KEY-EXEQRY trigger:
    Declare
       req   Varchar2(512) ;
    Begin
      req := '( UPPER(TAG) LIKE %' || :blk.item1 ||
    '% and (TAG LIKE %' || :blk.item1 || '% or TAG LIKE %' || :blk.item3 ||'%)) order by TAG ;
      Set_Block_Property( 'blk', DEFAULT_WHERE, req ) ;
      Execute_Query ;
    End ;Francois

  • Disableing an item in enter query mode

    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

    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.

  • Prevent interpretation of special characters in enter-query mode

    My problem goes as follows:
    - forms version: Forms [32 Bit] Version 6.0.8.10.3 (Production)
    - non-database item block.X, char
    - block.X is filled in post-query trigger. The post-query logic cannot be integrated in a view because it uses procedures, and usage of a pipelined function + view is currently not allowed due to "internal restrictions". Put simply: all logic to fill the field must remain in the post-query trigger
    - user wants the field to be queryable. This is achieved by storing the entered criterium in a variable in the pre-query trigger, and using it in the post-query trigger to exclude records. E.g.
    pre-query ==> help_block.query_X := block.X;
    post-query ==> if help_block.query_X is not null and block.X is null or not block.X like help_block.query then raise form_trigger_failure; end if;
    - this works fine for "regular" search strings. However:
    - whenever the search string starts with <, <=, >, >=, !, forms seems to interpret the leading characters before doing anything else. During pre-query, block.X is null, and as soon as I use it in pl/sql, I get FRM-40831: Truncation Occured: value too long for field. E.g.
    user puts the following in block.X ==> '<X', so he wants to search for records with value '<X' (text; not 'smaller than ...')
    pre-query => msg.show(block.X) ==> appears to be empty/null, but right after the message, I get FRM-40831 Truncation Occured: value too long for field ...
    This only happens if < is the first non-space character in the search string.
    Does anyone know of a way to prevent oracle from interpreting the <, <=, ... characters entered in enter-query mode?

    I'm sorry for not making myself clear; I'll give it another go:
    The problem is that, if I enter '<abc' in a form field in enter-query mode (so during creation of the "example record"), forms immediately interprets the < as 'smaller than' and does some obscure things with it (my guess: converting to a where clause, but since I'm using a non db field, this actually does nothing), and finishes by erasing the field contents (in the example record). In the pre-query trigger, I can no longer get the '<abc' and store it. I want one of the following:
    - prevent forms from interpreting the '<' in front (same thing happens for !=, <=, >=, =, ...)
    or
    - capture the entered string ('<abc') before forms reacts to the '<' in front
    Edited by: [email protected] on Feb 17, 2009 12:30 PM

  • Hotkey "Create Record" while the form is in enter-query-mode

    pressing the hotkey F6 for create-record while the block is in enter-query-mode results in the error - message:
    Function key not allowed. Press Ctrl+F1 for list of valid keys.
    The error-occurs although I created a trigger KEY-CREREC. The trigger isn't executed
    In older Forms versions the behaviour was different. Is there a way to let the form work like in the old versions?

    thnx for reply.Problem not solved.
    i m trying to assign the value of text item to a variable in pre-query trigger. i m able to get the value into variable when the string in the text item does not startwith <,>,=. but when the string starts with any one of the operator (<,>,=) it gives error.
    lenth of variable is 1000 charaters, and text item's max leanth is just 4 charactres.

  • FRM-40200 and FRM-40501 in Enter-Query-Mode

    Some strange behaviour in Enter-Query-Mode:
    Although the help states
    About Designing Forms for Querying+
    +.. To make a "query-only" block, set Query Allowed to Yes and Delete Allowed, Insert Allowed, and Update Allowed to No. ..+
    I get FRM-40200: Field is protected against update.
    System.Mode says, we are currently in ENTER-QUERY.
    Setting insert- and update-allowed to TRUE, I get
    FRM-40501: ORACLE error: unable to reserve record for update or delete.
    The entered character flashes and is erased immediately.
    Any ideas?
    Forms 10gR2
    Items are base table, all transactional properties aund query_allowed are true, query_length is ok.
    2 Things that happen before the initiation of the enter-query-mode:
    . data-source is changed to another view; column names are ok.
    . all block-items are disabled and not navigable at start-up of form and re-enabled and made navigable before entering the block.
    The values of block and item-properties mentioned above are take at WHEN-NEW-ITEM-INSTANCE and no further trigger fire.

    I think you are not meaning just the KEY-ENTQRY-Trigger, that to easy
    IF INSTR(:SYSTEM.TRIGGER_BLOCK, '_DETAIL') = 0
    +               AND :SYSTEM.TRIGGER_BLOCK NOT IN ('VZG_KOPF','KONTROLL','BUTTONS','TEMP')+
    THEN
    +     ENTER_QUERY;+
    END IF;
    .. but the rest is a lil bit, let's call it bulky; including pll and db-packageges.
    I hoped to get a clue, if somebody has a similar expeience, in what direction to search. It's strange.
    And, as I noticed today, it's not a problem of all forms of the app. Not even of all the forms called from the same "environment" (same globals, same menu-form from which they are opened). To me it looks like Enter-Query does not work in the forms where I switch the block-data-source from a view to a globally temporary table. That (this switching) is not a new feature and Enter-Query worked in the past. Althoug we had some changes in the temp tables in the last weeks there are no problems in querying the data in the forms. Recompilation of pll and fmb, no improvement. And either Enter-Query woks in a form or it does not.

  • Enter query - what was changed (entered) in enter query mode

    Hello,
    I need to know what criteria (values and items) an user entered (typed) when my form is in enter query mode.
    Thanks

    You can read about Pre-Query trigger in the Forms on-line help:
    About controlling queries with Pre-Query and Post-Query triggers
    The Pre-Query and Post-Query triggers allow control over query processing. They can be defined at the form or block level. Most often, attach them to specific blocks to control the query functionality of those blocks.
    The Pre-Query trigger fires just before Form Builder issues the SELECT statement to the database, after the operator has defined the example record by entering query criteria in Enter Query mode.
    Inside a Pre-Query trigger, the example record defined by the query criteria is the current record. This means that trigger code can read and set the values of items in the example record using standard :block_name.item_name syntax.
    A Pre-Query trigger can be used to disallow query conditions that might be invalid. When a form is in Enter Query mode, normal validation is suspended and no validation triggers fire as they do in Normal mode. The Pre-Query trigger thus allows you to verify that any values entered by the operator are valid query conditions.
    When invalid query conditions have been entered, you can abort the query by raising the FORM_TRIGGER_FAILURE built-in exception in the Pre-Query trigger.
    You can also call SET_BLOCK_PROPERTY to modify the block's WHERE and ORDER BY clauses from within the Pre-Query trigger, to further restrict or order the records the query will retrieve.
    I hope this will help you.
    Helena

  • Using Enter-Query Mode Programmatically

    A question was raised in an earlier thread
    QUERY CRITERIA MANAGER
    about how to use Enter-Query mode programmatically in a way that doesn't stop
    and prompt the user to enter a query after switching from Normal mode to Enter-Query mode.
    Since the solution may not be widely known, I thought I'd demonstrate the technique here in a new thread.
    Create a simple form with just two blocks. Using the data block wizard, create an EMP block with one
    text item for ENAME. Place it on the canvas. Create the other block as a control block and name it CONTROL.
    Inside the control block create the following items:
    - create a text item named TXT_BOX
    (The user will enter their search pattern criteria in this text box while in Normal mode.)
    - create a push button item named EXECUTE_QUERY
    (This button will switch to Enter-Query mode, execute the query, then return to Normal mode.)
    Place both control items on the canvas.
    Inside the WHEN-BUTTON-PRESSED trigger for the EXECUTE_QUERY button, enter the following code:
    DECLARE
         timer_id TIMER;
    BEGIN
         :GLOBAL.search_criteria := :CONTROL.TXT_BOX;
         GO_BLOCK('EMP');
         timer_id := CREATE_TIMER('ENT_QRY', 1500, NO_REPEAT);
         -- 1500 may be a little long, but provides a margin of error
         ENTER_QUERY;
    END;
    Next, create a WHEN-TIMER-EXPIRED trigger at the form level. Inside this trigger enter the following code:
    If GET_APPLICATION_PROPERTY(TIMER_NAME) = 'ENT_QRY' THEN
         :EMP.ENAME := :GLOBAL.search_criteria;
         EXECUTE_QUERY;
         IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
              EXIT_FORM; -- return to Normal mode
         END IF;
    END IF;
    GO_ITEM('CONTROL.TXT_BOX');
    Now, when the user runs the form and logs into the SCOTT schema, he enters a search criteria
    such as A% in the TXT_BOX while in Normal mode. Then clicks the EXECUTE_QUERY button.
    The form will switch to Enter-Query mode, retrieve all names in ENAME that begin with the letter A,
    and then return to Normal mode without pausing for the user to enter a search criteria.
    If the query should happen to fail, the form displays the error:
    "FRM-40301: Query caused no records to be retrieved. Re-enter."
    then switches automatically back to Normal mode so the user can try entering a new criteria.

    I'm showing how to do it when switching modes. I'm
    not suggesting this is the best way to do a query.We need to look at this in the context of the original probelm in the thread linked to above. For most cases the when-timer-expired etc is just a huge detour around using the pre-query trigger but it's an interesting approach to the specific problem in the earlier thread. The OP there wanted to be able to type '>5000' into a number field in a non-database block, which we can do in a database block in enter-query mode, and use it as a query parameter in the database block. Perhaps if we enter this into a character field in the non-database block and populate the numeric field in the database block whilst in enter-query mode then we can do searches on ranges of data? Unfortunately it doesn't work - you get an ora-06502 error just like you do when using the pre-query trigger. For the situation in the original thread you would have to use a 'default where'.

  • Enter-Query Mode

    I'm interested in starting a discussion on the restrictions of
    Enter-Query Mode, principally, why can you not navigate to a
    query only block whilst in this form mode? I have successfully
    implemented an full Query functionality without using the
    default forms behaviour, and wonder if there are any
    disadvantages that I have overlooked.
    null

    Kannan T. (guest) wrote:
    : Hi Steve,
    : Can you make your quest/requirement more clear and detailed,
    so
    : that I will be able to discuss with you for each specific
    : points.
    : With best regards,
    : Kannan
    Hi there,
    Its quite involved, I have some documentation that goes some way
    to describing the problem/solution, but briefly I find that when
    in 'Enter-Query' mode (system.mode = 'ENTER-QUERY') there are
    two restrictions
    1) You cannot navigate to another block. This is useful in a
    number of cases, like if you want to implement a more powerful
    List of Values facility, or provide the user a seperate screen
    to build up complex query criteria
    2) If you write a trigger that uses 'enter_query' built in,
    processing stops at this point. The standard workaround for this
    is to start a timer before the call to 'enter_query', and when
    the timer expires it performs the processing you want to do
    after 'enter_query'.
    So, I decided to rewrite the default forms enter/execute query
    processing (which was pretty straightforward), so my forms never
    go into 'Enter-Query' mode. What I am interested in is if there
    is anything that using the default forms processing gives, that
    I may have missed!
    Regards Steve
    null

  • [Solved] Problem with LOV and 'enter query' mode

    Hi all,
    I'm kind of new to Forms and I'm having some problems that I'm not being able to resolve. I already search it on the net, but nothing relevant came up. If anyone could help me I appreciated it.
    In my form I have some fields, and in one of them I have a LOV, and almost everything works fine. I inserted data, changed it, deleted it and all it's ok.
    But when I change to 'enter query' mode, when I try to search for data on the LOV field it ignores what I write.
    That is, for it, it's the same if I make F11 -> write 'aaaa' -> ctrl + F11 or if I make F11 -> '%' -> ctrl + F11.
    It behaves the same way, shows me all the records.
    Probably I'm missing something basic, but I'm not getting it...
    Thanks,
    Ana

    when you create a lov by wizard the lov and record group have always the same name..
    the problem is that the item is NOT based in the tabe.
    what kind of query do you execute if you choose something from a love which is not based on the db?
    i mean, this item has no influence on the query of the table, so whatever you choose it's like a "select * from table"
    i hope i was clear

  • Change background color in enter-query mode

    Hi everyone,
    I am trying to Change background color in enter-query mode in forms10g. I am using this
    Set_Item_property('org.branch_code', BACKGROUND_COLOR, 'Green' );
    Thanks

    This is the code that allows to colorise items in enter_query mode, then de-colorize them after execute_query.
    Assume that you have created a VA_QUERY visual atribute in your module.
    -- Colorise in enter-query mode --
    PROCEDURE Start_query IS
      LC$Block      Varchar2(30) := Name_in('system.trigger_block') ;
      LC$item       varchar2(60);
      LC$itemdeb    varchar2(60);
      LN$len        pls_integer ;
    BEGIN
      lc$itemdeb := get_block_property(LC$BLOCK, FIRST_ITEM) ;
      lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      while lc$itemdeb is not null Loop
        IF GET_ITEM_PROPERTY(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
          IF GET_ITEM_PROPERTY(LC$Item , QUERYABLE ) = 'TRUE' Then
            set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_QUERY');
          End if ;
        End if ;
        lc$itemdeb := get_item_property( lc$item, NEXT_NAVIGATION_ITEM );
        lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      end loop ;
    END;
    -- Unclororize after execute_query --
    PROCEDURE End_query IS
      LC$Block     Varchar2(30) := Name_in('system.trigger_block') ;
      LC$item     varchar2(60);
      LC$itemdeb     varchar2(60);
      LN$len          pls_integer ;
      LN$Multi  pls_integer ;
    BEGIN
      lc$itemdeb := get_block_property(LC$BLOCK, FIRST_ITEM) ;
      lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      LN$Multi := GET_BLOCK_PROPERTY(LC$Block , RECORDS_DISPLAYED ) ;
      while lc$itemdeb is not null Loop
        IF GET_ITEM_PROPERTY(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
          IF GET_ITEM_PROPERTY(LC$Item , QUERYABLE ) = 'TRUE' Then
             If LN$Multi > 1 Then
                set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_CURRENT_RECORD');
             Else
                set_item_property(LC$item, CURRENT_RECORD_ATTRIBUTE, '');
             End if ;
          End if ;
        End if ;
        lc$itemdeb := get_item_property( lc$item, NEXT_NAVIGATION_ITEM );
        lc$item := LC$BLOCK || '.' || lc$itemdeb ;
      end loop ;
    END;Francois

  • How to display LOV on web in ENTER-QUERY mode with form or block query only.

    Hello all
    How can I display lov automatic on the web in from enter-query
    mode in form or block query only mode.
    thankx

    If I understand correctly your explanation, your called form
    fails to activate the LOV in enter-query mode when it is deployed
    and test on the browser.
    So lets proceeed like this, to make it work in all environments,
    let us programetically activate the LOV.
    HOW?
    In the called form, write in the WHEN-NEW-ITEM-INSTANCE TRIGGER
    at block level (if have more than one LOV)
    IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
    IF get_item_property(:system.cursor_item,lov_name) IN ('YOUR
    LOV1', 'LOV2' etc) THEN
    IF SHOW_LOV(get_item_property(:system.cursor_item,lov_name))
    THEN
    NULL;
    END IF;
    END IF;
    END IF;
    The above code maybe tweak to suite your need and condition.
    This way, we explicitly make the LOV appear in ENTER-QUERY mode
    whenever the user clicks on an item with an attached LOV.
    Hope this helps.
    Mohammed R.Qurashi

  • Changing visual attribute in Enter Query mode

    Hello, I want to change visual attribute of all items in the first record when the user presses button for Enter_Query. I want that the user sees that the form is in enter query mode and it "waits" for the input of criteria. My code (copied from Help and modified) in trigger WHEN_BUTTON_PRESSED:
    DECLARE
    cur_itm VARCHAR2(80);
    cur_block VARCHAR2(80);
    BEGIN
    ENTER_QUERY;
    cur_block := :System.Cursor_Block;
    cur_itm := Get_Block_Property( cur_block, FIRST_ITEM );
    WHILE ( cur_itm IS NOT NULL ) LOOP
    cur_itm := cur_block||'.'||cur_itm;
    Set_Item_Instance_Property( cur_itm, CURRENT_RECORD, VISUAL_ATTRIBUTE,'yellow');
    cur_itm := Get_Item_Property( cur_itm, NEXTITEM );
    END LOOP;
    END;
    where yellow is the name of my visual attribute.
    The problem is that I need to press the button TWICE to color the record.
    Can anybody help me with this problem?
    Natasa

    (Wrong forum).
    The problem is that enter_query stops executing your procedure until
    another action ist started by the user.
    You must create a short-time timer before issuing enter_query and set
    your colour scheme in the when-timer-expired-trigger.

Maybe you are looking for

  • 2.1 3G update just a "show more bars" change?

    I'm STILL getting failed calls. I make or take a call and can get 4 words in before the call fails. Yeah, my bars now show 4 full bars, all the time... I'm starting to think maybe just the graphical part of the bars and 3G was changed, not the actual

  • Difficulty networking to Windoze computer

    We are new to Apple and are trying to network to our existing Windows computers. One of them is running XP Home and it seems to connect to it just fine. The other is W2k and it shows up in "MSHOME" in the network panel, but when I click on it, it bri

  • Query Execution taking Longer Time

    Hi BI Gurus, There is one some ABC query which was built on multiprovider, when I am trying to execute it in BEx analyzer in production system it is taking long run and then giving short dump. I have checked data in the multiprovider it is not more t

  • FileServer Resource Failed - No storage is available message.

    1st node: TSMCTN (Working Fine) 2nd node: TSMCTADM (FileServer-(TSMCTNADM)(Cluster Disk 3) Failed) First attempt, I try to delete File Server Resource without CAP (Client Access Point), it give me the network name "hostname+FQDN" is already in used i

  • How to stress test VC 7.0 applications ?

    Hello, I'm a sap basis guy, our developers team will very soon deploy Visual Composer 7.0 applications on our Portal Production environnement. I have been asked to to check whether the current portal configuration will be able to handle the additiona