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

Similar Messages

  • [ 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

  • 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.

  • 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

  • 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.

  • Calling form in Enter-Query mode

    Hi
    how can i Have a form called from the menu (generated with
    headstart) start in Enter-Query mode ?
    Is there any method to do this easily ??
    TIA
    Olivier
    null

    Olivier,
    Look in the Headstart Template Package users guide. In the
    Runtime Behaviors chpt, under Inter-Form Navigation, Named Passed
    Values and Argument Passed Values, you will find an explanation
    of how to start a form in Enter-Query mode.
    Regards,
    Lauri
    Olivier GIBERT (guest) wrote:
    : Hi
    : how can i Have a form called from the menu (generated with
    : headstart) start in Enter-Query mode ?
    : Is there any method to do this easily ??
    : TIA
    : Olivier
    null

  • 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

  • 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

  • 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

  • FRM:41361 Cannot navigate out of form in 'Enter Query Mode'

    Hi,
    I am using a master - detail block in my form.When I query the master block I am getting this error message
    FRM:41361 Cannot navigate out of form in 'Enter Query Mode'
    I have given DO_KEY('ENTER-QUERY') in WHEN-NEW-BLOCK-INSTANCE trigger of master block.
    and in property palette of Master block I have given the next navigation block as Detail block.
    According to the value which is queried in Master Block the Detail block should be populated.
    My form should open in 'Enter Query Mode'.This problem always happens from second time onwards
    I open the form.When I open the form first time this problem is not occuring.
    Can anyone suggest a solution for this
    Thanks,
    Nasiya

    Have you written a Key-EntQuery trigger at the Master block or the form level,
    If yes, then can you put that code here.
    The NEXT-NAVIGATION-BLOCK is only used for navigation when you use a next-block built-in on a key-trigger.
    Have you written a ENTER-QUERY command on any trigger that fires prior to the said WHEN-NEW-BLOCK-INSTANCE trigger?
    If yes, then thats the reason that the first time you run the form, your form is in ENTER-QUERY mode.
    Also, maybe execute on enter-query fails and hence the blocks are not getting populated.
    Also, ENTER-QUERY is always on a single block. And while the block is in enter-query mode, navigation out of that block is prohibited.
    you have to either have a successful EXECUTE-QUERY or use:
    EXIT_FORM(NO_VALIDATE) to come out of ENTER-QUERY mode.

  • Enter Query Mode with Block Based on Stored Procedure

    How can I get the ENTER QUERY mode to work when the data block is based on a stored procedure?

    Thank you for your review.
    Because the package is long, I stripped most of it out, but left the basics. After I stripped out the code, I ran the new code under a new user. Under the new user I built I new form, tested it, and I still cannot use the ENTER QUERY mode to retrieve the correct record. Query always returns the first record. I have included table structure and 3 test records.
    CREATE TABLE FR_Charge      
    (      FR_Charge_ID               NUMBER(8),
         FR_Charge_Code               VARCHAR2(8) CONSTRAINT FR_Charge_Code_nn NOT NULL,
         FR_Charge_Code_DESC          VARCHAR2(35),
         FR_Charge_Code_CMT          VARCHAR2(50),
              CONSTRAINT FR_Charge_pk PRIMARY KEY (FR_Charge_ID)
    CREATE SEQUENCE FR_Charge_SEQ;
    INSERT INTO FR_Charge
    VALUES(FR_Charge_SEQ.NEXTVAL,'0.0WS','E-Mail Notification', NULL);
    INSERT INTO FR_Charge
    VALUES(FR_Charge_SEQ.NEXTVAL,'0.1', 'Shipping', NULL);
    INSERT INTO FR_Charge
    VALUES(FR_Charge_SEQ.NEXTVAL,'0.12', 'Shipping Charges', NULL);
    --Package follows
    CREATE OR REPLACE PACKAGE DataCard_Pkg
    AUTHID CURRENT_USER
    AS
         -- The following records defines the data structure needed by the FR_Card.
         TYPE FR_Charge_Record IS RECORD
         (     FR_Charge_ID                    FR_Charge.FR_Charge_ID%TYPE,
              FR_Charge_Code                    FR_Charge.FR_Charge_Code%TYPE,
              FR_Charge_Code_DESC               FR_Charge.FR_Charge_Code_DESC%TYPE,
              FR_Charge_Code_CMT               FR_Charge.FR_Charge_Code_CMT%TYPE
         -- REF CURSOR definition used by the query procedure.
         TYPE FR_Charge_REFCUR IS REF CURSOR RETURN FR_Charge_Record;
         -- INDEX OF TABLES used for the DML Operation procedures.
         TYPE FR_Charge_Table IS TABLE OF FR_Charge_Record
              INDEX BY BINARY_INTEGER;
         --Define Procedure Specifications
         PROCEDURE FR_Charge_Query (DMLResultSet IN OUT FR_Charge_REFCUR);     
         PROCEDURE FR_Charge_Lock (DMLResultSet IN OUT FR_Charge_Table);
         PROCEDURE FR_Charge_Insert (DMLResultSet IN OUT FR_Charge_Table);
         PROCEDURE FR_Charge_Update (DMLResultSet IN OUT FR_Charge_Table);
         PROCEDURE FR_Charge_Delete (DMLResultSet IN OUT FR_Charge_Table);
    END DataCard_Pkg;
    CREATE OR REPLACE PACKAGE BODY DataCard_Pkg
    AS
         PROCEDURE FR_Charge_Query (DMLResultSet IN OUT FR_Charge_REFCUR)
         IS
         BEGIN
              OPEN DMLResultSet FOR
              SELECT FR_CHARGE.FR_Charge_ID,
                   FR_CHARGE.FR_Charge_Code,
                   FR_CHARGE.FR_Charge_Code_DESC,
                   FR_CHARGE.FR_Charge_Code_CMT
         FROM FR_Charge;
         END FR_Charge_Query;
         PROCEDURE FR_Charge_Lock (DMLResultSet IN OUT FR_Charge_Table)
         AS
              x_index NUMBER := 1;
              x_count NUMBER := DMLResultSet.COUNT;
              x_dummy_var VARCHAR2(1);
         BEGIN
              FOR x_index IN 1..x_count LOOP
                   SELECT 'X'
                   INTO x_dummy_var
                   FROM FR_Charge
                   WHERE FR_Charge_ID = DMLResultSet(x_index).FR_Charge_ID
                   FOR UPDATE NOWAIT;
              END LOOP;
         END FR_Charge_Lock;
         PROCEDURE FR_Charge_Insert (DMLResultSet IN OUT FR_Charge_Table)
         AS
              x_index NUMBER := 1;
              x_count NUMBER := DMLResultSet.COUNT;
         BEGIN
         FOR x_index IN 1..x_count LOOP
              INSERT INTO FR_Charge
              (      FR_Charge_ID,
                   FR_Charge_Code,
                   FR_Charge_Code_DESC,
                   FR_Charge_Code_CMT
              VALUES                               
              (     FR_Charge_SEQ.NEXTVAL,
                   UPPER(DMLResultSet(x_index).FR_Charge_Code),
                   DMLResultSet(x_index).FR_Charge_Code_DESC,
                   DMLResultSet(x_index).FR_Charge_Code_CMT
              END LOOP;
         END FR_Charge_Insert;
         PROCEDURE FR_Charge_Update (DMLResultSet IN OUT FR_Charge_Table)
         AS
              x_index NUMBER := 1;
              x_count NUMBER := DMLResultSet.Count;
         BEGIN
              FOR x_index IN 1..x_count LOOP
              UPDATE FR_Charge
                   SET FR_Charge_Code = UPPER(DMLResultSet(x_index).FR_Charge_Code),
                   FR_Charge_Code_DESC = DMLResultSet(x_index).FR_Charge_Code_DESC,
                   FR_Charge_Code_CMT = DMLResultSet(x_index).FR_Charge_Code_CMT
              WHERE FR_Charge_ID = DMLResultSet(x_index).FR_Charge_ID;
              END LOOP;
         END FR_Charge_Update;
         PROCEDURE FR_Charge_Delete (DMLResultSet IN OUT FR_Charge_Table)
         AS
              x_index NUMBER := 1;
              x_count NUMBER := DMLResultSet.Count;
         BEGIN
              FOR x_index IN 1..x_count LOOP
                   DELETE FROM FR_Charge
                   WHERE FR_Charge_ID = DMLResultSet(x_index).FR_Charge_ID;
              END LOOP;
         END FR_Charge_Delete;
    END DataCard_Pkg;

  • Suppress the enter-query mode when no-data-found after execute a query.

    HI,
    Greetings of the day, Can any one suggest me that how to Suppress the enter-query mode when no-data-found after execute a query on the form by a button.
    whenever i execute query on form and result is no data found then form :system.mode is still in enter-query mode.
    i want that if result is no data found then form comes back it initial state.
    i will thank full of him who will help me..
    Thanks in Advance..

    Put this in your Key-ExeQry trigger:Execute_Query;
    If Get_block_property(:System.current_block,query_hits)=0 then
      Exit_form; --this cancels the Enter-Query mode; Does not exit the form.
    End if;You may want to trap and prevent the "FRM-40353: Query cancelled" message, and change the "FRM-40301: Query caused no records to be retrieved. Re-Enter" message. To do that, you need an On-Message form-level trigger:Declare
      Msg_Code Number        := MESSAGE_CODE;
      MSG      Varchar2(150) := SUBSTR('   '||MESSAGE_TYPE||'-'
                             ||TO_CHAR(Msg_Code)||': '||MESSAGE_TEXT,1,150);
    BEGIN
      If Msg_Code=40301 then
           -- 40301: Query caused no records to be retrieved. Re-Enter
        Message('  NO RECORDS FOUND',No_acknowledge);
      Elsif Msg_Code=40353 then -- Query cancelled.
        null;
      Else
        MESSAGE(MSG,NO_ACKNOWLEDGE);
      End if;
    End;

  • Enter Query mode to Normal Mode

    In my form i have a modify button. After clicking the modify mode, the mode will be enter-query. I have a number field. After entering the number i will be prompting the user to select yes or no from an alert. If he is selecting yes i will execute query modify save.. no problem.
    If he is select no.. i am populating the values from a procedure.. i want to insert a new record.. but now i want to change the enter query mode.. how do that...
    If i am using Exit_form; the populated details are getting cleared..
    please help me..

    Hi,
    Try using Abort_query. Hope it will help you.
    Regards
    Gaurav Thakur

  • [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

Maybe you are looking for

  • IPhone 4S no longer seeing 5 GHz Wifi signals with iOS 7

    iPhone 4S no longer sees 5 GHz wifi band. With iOS 6 the phone saw and connected to the 5 GHz band. I just updated to iOS 7 and the band is not even shown. The 2.4 GHz band was always seen, and now it's the only one. Restarting did not ameliorate the

  • Images in jar file, Please help!!

    Hello, This is my code, I am trying to add images to buttons in ToolBar. The code along with images works if I say "java ABC", but dont work(images dont appear) when I jar the files. I have tried all the possible methods, Please help me.           ne

  • Transfer all content to another iMac?

    I have an older iMac that I was using that I would like to give to my wife as a replacement for her even older iMac. I have used firewire disk mode and even Time Machine to set up a New iMac, but I have never attempted to set up an existing iMac with

  • Problems when starting up my Mac Pro

    Hi all, When I start up my Mac Pro (2.66) it the light on the mac will turn on but there is no chime, no display. The second time I start up the Mac it chimes and the display runs up to the grey screen but then it pauses and a fan (don't know which o

  • Downloading and installing Acrobat X Standard on a second computer

    I have Acrobat X Standard on my desktop and want to install a copy on my new laptop. How do I do this?