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

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

  • 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

  • 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

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

  • 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

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

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

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

  • EXIT_FORM in enter query mode

    Hi Guys,
    I have a button on my form to exit the form code is:
    EXIT_FORM(No_Validate);
    when my form is in enter query mode the button does not work. i have to cancel the query first and then the button works.
    How can i change my mode to exit form even if it is in enter query mode.
    Please help its urgent.
    thanks , Imran Baig

    HI Imran,
    That is quite normal. If you press CTRL/Q, it executes an implicite Key-EXIT trigger. If you are in Enter Query mode, this will close the query and does nothing else. When you execute it again, you leave the from without validation.
    My suggestion were: Place the exit_form(no_validate) twice in your trigger--the second would be absolute harmless, since the form will no longer be active, provided you came from Normal Mode. Otherwies, it will force leaving the form by first closing the query and then leaving.
    Regards, Miklos Herboly.

  • 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

  • LOV button in enter query mode

    Hi
    How do I show LOV button(Forms 9.0.2) in enter query mode?As of now LOV button is displayed only in the create mode.
    Binod.

    Hi Andrew,
    Thanx for the reply. Actually I have not associated any trigger for this. Here Im refering the LOV button which comes inside the respective field(I mean we change the property lov_button to 'true in the regitry.dat). This button is not getting displayed in the enter query mode.
    I hope now you are clear with the query.
    Binod.

Maybe you are looking for

  • I can no longer access My Yahoo Finance Portfolios.

    I have had Yahoo personal finance portfolios for years. Now when I try to access those portfoilos from MyYahoo, I go the the login screen where I am asked to enter my password. I enter my password and press enter and ... then I am taken right back to

  • My built-in speaker no longer works on iPhone 4

    it is less than a month old and i have an Otter cover for it. When i took the cover off after this happened a few days ago the sound came back through the speaker. Now it no loger works whether the cover is on or off.

  • Why do pdfs sometimes print darker?

    There are some expected answers to this question but I would love to get a whole lot of input to cover all my bases. Why will some colours print out darker or differently do the work file or PDF? Is it due to the paper type it is printed on? Or that

  • What happened to the Inspiration Browser in Photoshop 11? Did something else replace it?

    The earlier version of Photoshop I was using had an Inspiration Browser.  Did it go away, was it replaced?

  • Easy question for any over-critical java tech!

    hi over-critical java tech man/woman. i have this class library for org.apache.poi.* .. which i will be using to manipulate .xls and .doc type files. i need help installing it. i havnt tried any command-line stuff yet, which im sure is the right way