Set_block_property and Default_where

Hi All,
I'm trying to set the default clause at runtime,for that i'm using set_block_properties.
Here is my cde:
Set_block_property('RECIPIENT_VIEW',DEFAULT_WHERE,'RECIPIENT_NAME LIKE '||''''||:RECIPIENT_NAME ||'%'||'''');
I'm NOT getting if i use this in KEY-EXEQRY or PRE-QUERY triggers(I'm getting it, when i use this in button).
How can solve this problem in KEY-EXEQRY or PRE-QUERY triggers ?
Please help me.
Thanks
P

Because form default enter-query, execute-query buttons look your input format:
1) if you type in A in the field, then form constructs the default where by appending additional RECIPIENT_NAME ='A';
2) If you type in A% in the field, then form constructs it by appending the additional RECIPIENT_NAME LIKE 'A%';
That's to say, if you SET_BLOCK_PROPERTY('blockname',
DEFAULT_WHERE,
'RECIPIENT_NAME LIKE '''||:RECIPIENT_NAME ||'%'||''') in the PRE-QUERY trigger of forms6i, then the block where condition becomes the below format,
for 1) input:
RECIPIENT_NAME LIKE 'A%' AND RECIPIENT_NAME ='A'
for 2) input:
RECIPIENT_NAME LIKE 'A%' AND RECIPIENT_NAME ='A%'
Therefore, for input 'A%' it will work for you, for input 'A', it will have no much chance to get the record unless you make record 'A', then it will get you the data.
Remember, after you type in something, the block where clause changed if you use the default menu enter/execute-query buttons.
you will see it if you check the :system.last_query.

Similar Messages

  • Set_block_property('emp',default_where,...) with variables

    db and dev 10g rel2 ,
    i am trying to learn about this built-in with variables and the equal(=) operator , i can not use it with variables , so show me please how to use it with number , charachter and date variables .
    1- working with number variables .
    - i have the block 'scott.emp' , and a button 'search' .
    - my variable 'v' holds the value 7788 , and i want to display the data based on this number of the 'empno' column .
    how to do it with set_block_property ?
    thanks in advance
    Edited by: newbi_egy on Apr 5, 2013 3:11 PM
    Edited by: newbi_egy on Apr 6, 2013 2:55 PM

    newbi_egy wrote:
    this is so correct HamidHelal , but what i want to ask about is ,
    i know that the part after "default_where" of the set_block_property built-in should reside between two single quotes like so
    set_block_property('emp',default_where,' ') ;
    but your letters does not reside between these single quotes ' ' , what resides is just this ('empno=') , and if the whole sentence should reside between single quotes , it should be like so
    ('''empno='||v'') as the two quotes at the beginning of the sentence and at the end are in fact one quote (one at the beginning and one at the end . -- these are which enclude the whole sentence which is ('empno=') .should not it work like so ? -- sure it is not working , but i want to understand why is not it working ? Ok. working statement is
    SET_BLOCK_PROPERTY('emp', DEFAULT_WHERE, 'empno = '|| V);where 'empno = ' is fixed string. variable value of V is concatenate.
    Following statement also work. and meets set_block_property('emp',default_where,' ') ;
    SET_BLOCK_PROPERTY('emp', DEFAULT_WHERE, 'empno =7788 ');What is the difference ?
    Difference is, in the first statement we set the empno value dynamically where second one is fixed.
    Hope it's clear..
    Hamid

  • Set_block_property and execute_query

    I created two forms say f1 and f2. I have a button pb1 in f1, when I press pb1, the second form f2 is called.
    Now in form f2, I implemented the trigger when_new_form_instance as follows:
    set_block_property('users', default_where, 'id=:global.user_id');
    execute_query;
    The problem is that the query is not executed. If I replace the above two lines with:
    select first_name, last_name into :user.first_name, :user.last_name
    from users
    where id=:global.user_id;
    then this query executed. Anybody help me please?
    By the way, if anybody could give me a simple form (detailed steps) to implement the following:
    1) when the form first loads, it executes a query automatically.
    2) a button "Save" to let me save changes on any fields (insert or update?).
    Thanks a bunch.

    Check if you have set the where clause in the block property of the form during design time ie. set the where clause in the blocks property sheet. The set_block_property's default_where will not override the where clause set during the design time. The implicit query which you are giving will always work.
    Hope this helps.

  • Set_block_property('IM_NEW_ITEMS',default_where,where_string) ;

    declare
         where_string varchar2(200):= 'COP_CODE = :GLOBAL.COP_ORDER_CODE' ;
         REC_PRE NUMBER;
    BEGIN
         SELECT COUNT(*) INTO REC_PRE FROM IM_NEW_ITEMS
    WHERE COP_CODE = :GLOBAL.COP_ORDER_CODE ;
    if NVL(REC_PRE,0) != 0 then
         set_block_property('IM_NEW_ITEMS',default_where,where_string) ;
         go_block('IM_NEW_ITEMS');
         execute_query;
         LAST_RECORD;
         set_block_property('IM_NEW_ITEMS',default_where,'') ;
         NEXT_RECORD;
    SHOW_MESSAGE(':SYSTEM.RECORD_STATUS'||' '||:SYSTEM.RECORD_STATUS);
    :IM_NEW_ITEMS.ITEM_CLASS := :GLOBAL.CLASS_CODE;
    REC_PRE := 0;
    end if;
    end ;
    my problem is appear when I want to insert a new record it does not insert
    the new record in the current form.
    So how to change the set_block_property to the insert mode , so that the records
    will be inserted in the in the current form.
    Best regards
    Jamil Alshaibani

    Hi
    No I do not want to insert the same set of record after populating data from the same table,
    I am using the following script
    LAST_RECORD;
    set_block_property('IM_NEW_ITEMS',default_where,'') ;
    NEXT_RECORD;
    To create a new record, so what I want to insert is the new created record only,not the retrieved records.
    Thank a lot for your cooperation .
    Best regards
    Jamil

  • Set_block_property with Like and Between and function

    Hellow All
    I need to find out record where Column Name between
    :Text_item1 and :Text_item2 with Default_where
    For example Manu guide me to find out record with
    SET_BLOCK_PROPERTY('Block53', DEFAULT_WHERE, 'name like ''' || :block70.text || '%''');
    go_block('block53');
    EXECUTE_QUERY;
    Now i need
    To find our Record where name between :block70.Text1 and :Block70.text2 with Like Function
    For example
    I have one Column :NAME
    I want to find out record in name Column with Default Where option where name between Text1 and Text2
    I Hope you guys understand my requirement
    Regards
    Shahzaib ismail

    Hai,
    Try
    SET_BLOCK_PROPERTY('BLOCK53', DEFAULT_WHERE, 'NAME BETWEEN ''' || :BLOCK70.TEXT1 || ''' AND ''' || :BLOCK70.TEXT2 || '''');
    GO_BLOCK('BLOCK53');
    EXECUTE_QUERY;and when you are using BETWEEN for character fields, then LIKE will be there.
    Example, your NAME field have,
    1) Abcde
    2) Asdf
    3) Awer
    And if your condition is NAME BETWEEN 'A' AND 'Z' then you will get all daya.
    And if your condition is NAME BETWEEN 'Ad' AND 'Z' then you will get 2 and 3. like that.
    Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Conflict between DEFAULT_WHERE and ONETIME_WHERE block properties

    Hi all,
    I have a master detail form.
    I noticed a very strange behaviour :
    the following syntax freezes the form :
    Set_Block_Property('JOURHEAD',DEFAULT_WHERE,' IDENT= '||FV.V_IDENT);
    Set_Block_Property('JOURHEAD',ONETIME_WHERE,'VOCH_NO='||''''||V_PREV_record||'''');
    Execute_query;
    However the following syntax doesn't freeze the form :
    Set_Block_Property('JOURHEAD',ONETIME_WHERE,'VOCH_NO'||'='||''''||V_PREV_record||''''||' AND IDENT='||FV.V_IDENT);
    Execute_query;
    Aren't the two syntax the same ??
    Please help

    Hi Gerd;
    Thank you for your response
    Gerd, We shouldn't put the 'AND' in the onetime_where, It will be generated automatically.
    This is from the online help :
    For an Emp/Dept form with a default-where clause for the Emp block set to 'empno > 7800' and a push button, do the following: When-Button-Pressed:Set_Block_Property('emp', ONETIME_WHERE, 'deptno <= :dept.deptno'); If a query is performed after pushing the button, the generated query would like the following using the :SYSTEM.LAST_QUERY: Select empno, ename, ... From Emp Where empno> 7800 And depnto <= 10 (in this case the deptno of the DEPT block is 10).
    Regards
    Mostafa

  • Set_block_property(' ',default_where,' ') built-in

    db and dev 10g rel2 , xp
    hi all,
    if anyone could demonstrate this built-in to me , when using it with number and charachter or date text_fields ,
    specially with (= and like) operators .
    because i have a problem with using quotes with it . i do not know the roles for using quotes with it .
    for in stance , i have the table emp , and two text items , one to execute the query on the block by the deptno column , and the other with date or charachter column like hiredate or ename , i think the two are the same .
    if you could give me an example and demonstrate it please .
    thanks in advance

    If you are using forms items/parameters you can actually use them in the default where like bind variables and not care about quotes at all. Let's say you have a block with one number, one date and one char item (all non-basetable). You'd simply could
    set_block_property('basetable_block', default_where, 'where num_col = :blk.num_item or char_col = :blk.char_item or date_col = :blk.date_item');as you can see no quote escaping no matter of the data type.
    It get's a little bit harder when you are using PL/SQL variables as you cannot bind them like you can with items or parameters
    set_block_property('basetable_block', default_where, 'where num_col = '||num_val||' or char_col = '''||char_val||'''');it get's worse with dates:
    set_block_property('basetable_block', default_where, 'where date_col = to_date('''||to_char(date_val,'dd.mm.yyyy')||''',''dd.mm.yyyy'')');To demonstrate how escaping actually works we'll translate the where clauses the way they get sent to the database; assuming num_val has a value of 3, char_val has a value 'ABCD' and date_val has a value of 01.01.2013.
    where num_col = '||num_val|| or char_col = '''||char_val||'''would be
    where num_col = 3 or char_col = 'ABCD'
    where date_col = to_date('''||to_char(date_val,'dd.mm.yyyy')||''',''dd.mm.yyyy'')would be
    where date_col = to_date('01.01.2013','dd.mm.yyyy')If in doubt with escaping simply output the string to e.g. a file, and when it contains valid SQL you did everything right with the escaping.
    cheers
    EDIT: this is actually pen-and-paper writing of code; I didn't compile anything of the above so it might be that some of the ' are missing, but I guess you should get the point.
    Edited by: christian erlinger on 27.02.2013 05:25

  • Set_block_property default_where problem

    Dear proffessionals,
    during setting the set_block_property value for database block i'm facing next problem:
    1. Query select cr_pjid from acc_users where username='ACCBTPS121' give result
    CR_PJID 
    '26','63'2. Query select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in ('26','63'); return 186 rows.
    3. Query: select * from acc_accbtp_nova_view where ed_id=2 and
                  to_char(pj_id) in (select cr_pjid
                  from acc_users
                  where username='ACCBTPS121'); doesn't return any row... :(
    So, set_block_property('acc_accbtp_nova_view',default_where,'ed_id = '||':global.org_dio_id and to_char(pj_id) in (select to_char(cr_pjid) from acc_users where username=user)'); doesn't work...
    Could anyone help me ?
    Thx in advance,
    Adnan
    Edited by: adnanBIH on Nov 20, 2010 10:25 AM

    and like this?
    DECLARE
      vStr acc_users.cr_pjid%TYPE;
    BEGIN
      SELECT cr_pjid
      INTO vStr
      FROM acc_users
      WHERE username=user;
      SET_BLOCK_PROPERTY('acc_accbtp_nova_view',DEFAULT_WHERE,'ed_id = :global.org_dio_id and to_char(pj_id) in ('||vStr||')');
    END;-Ammad

  • Re Set Set_Block_Property DEFAULT_WHERE value

    I have a Tabular form which have the invoice details with below two Buttons
    BTN_QUERY (WHEN-BUTTON_PRESSED) TRIGGER
    go_block('BLFRT');
    execute_query;BTN_UNRECEIPT (WHEN-BUTTON_PRESSED) TRIGGER
    if :system.mode like 'NORMAL' then
    go_block('BLFRT');
    Set_Block_Property('BLFRT',DEFAULT_WHERE,' BL_REC_FLAG IS NULL');
    execute_query;
    end if;As soon i click BTN_QUERY i get the data in the grid and also when i click BTN_UNRECEIPT also works fine.
    the problem is after clicking BTN_UNRECEIPT if i click BTN_QUERY it shows the filtered records and not all the records. i can understand it's because the value is set with BL_REC_FLAG IS NULL. how to clear this and show all records IN BLFRT when i click BTN_QUERY

    Hi,
    Try to use PRE-QUERY trigger and use
    Set_Block_Property('BLFRT',DEFAULT_WHERE,' BL_REC_FLAG IS NULL');
    on conditional bases
    Regards,
    Uzair Hasan Nizami

  • Open_form with parameter list and execute_query

    Hello all.
    In a 6i form WBPressed trigger creates the parameter list
    begin
        v_paramlist_id := create_parameter_list('FRM_PARM_LIST');
        add_parameter('FRM_PARM_LIST', 'P_CUST_NUM', TEXT_PARAMETER,
                       to_char(:CUSTOMER_INFO.CUST_NUM));
        open_form('CUSTOM_SCORING', ACTIVATE, SESSION,                   
                         NO_SHARE_LIBRARY_DATA, 'FRM_PARM_LIST');
       destroy_parameter_list('FRM_PARM_LIST');
    end;Then in the second form, WNFInstance trigger has:
        if :PARAMETER.P_CUST_NUM is not null
         then
         GET_PARAMETER_ATTR('FRM_PARM_LIST', 'P_CUST_NUM', x, v_cust_num);
         set_block_property('CUST_SCORING', DEFAULT_WHERE,
                         'CUST_NUM = to_number('||v_cust_num||')');
         go_item('cust_scoring.cust_num');
         do_key('execute_query');I get FRM-40505 Unable to perform query. It was working, but I broke it along the way. Does this much seem correct to open the second form and query the specific customer?
    Upon opening the second form in the Developer tool, it cannot locate a custom Object Library called PARAMETERS. I deleted it & drug it in again from the original (sub-classed). Sould I do the entire library?
    Thanks.

    Hey - I think I see the problem today.. (fresh set of eyes)
    open_form('CUSTOM_SCORING', ACTIVATE, SESSION,
    NO_SHARE_LIBRARY_DATA, 'FRM_PARM_LIST');
    Change this to
    open_form('CUSTOM_SCORING', ACTIVATE, SESSION,
    NO_SHARE_LIBRARY_DATA, v_paramlist_id );
    Hello all.
    In a 6i form WBPressed trigger creates the parameter
    list
    begin
    v_paramlist_id :=
    := create_parameter_list('FRM_PARM_LIST');
    add_parameter('FRM_PARM_LIST', 'P_CUST_NUM',
    UM', TEXT_PARAMETER,
                       to_char(:CUSTOMER_INFO.CUST_NUM));
    open_form('CUSTOM_SCORING', ACTIVATE, SESSION,
    ION,                   
    NO_SHARE_LIBRARY_DATA,
    O_SHARE_LIBRARY_DATA, 'FRM_PARM_LIST');
    destroy_parameter_list('FRM_PARM_LIST');
    end;Then in the second form, WNFInstance trigger has:
    if :PARAMETER.P_CUST_NUM is not null
         then
    GET_PARAMETER_ATTR('FRM_PARM_LIST', 'P_CUST_NUM', x,
    , v_cust_num);
         set_block_property('CUST_SCORING', DEFAULT_WHERE,
                         'CUST_NUM = to_number('||v_cust_num||')');
         go_item('cust_scoring.cust_num');
         do_key('execute_query');I get FRM-40505 Unable to perform query. It was
    working, but I broke it along the way. Does this
    much seem correct to open the second form and query
    the specific customer?
    Upon opening the second form in the Developer tool,
    it cannot locate a custom Object Library called
    PARAMETERS. I deleted it & drug it in again from the
    original (sub-classed). Sould I do the entire
    library?
    Thanks.

  • In clause with default_where

    hi all,
    i am using forms6i.
    i have to query a data block with in clause query
    Go_Block('EMPLOYEE_MASTER');
    Set_Block_Property('EMPLOYEE_MASTER',Default_Where,'emp_dept IN ('''||:dept||''''||')');
    Execute_Query;in my code 'dept ' is the field where i input the value. the problem is if pass multiple department then i have to passit like
    it','accounts. that means quotes are required before and after comma.
    is this is the way to input multiple valule sepeated by comma, or do we have any alternative way to input a multiple string.
    Please advice.
    Thanks..

    Hi GD,
    Set_Block_Property('EMPLOYEE_MASTER',Default_Where,'emp_dept IN ('''||:dept||''''||')');If :dept has numeric values like 1,2,3,4 then the above line will work.
    If so, this means there is a reference to a single value, not a list of values. Can the user enter a list in the :DEPT field (eg: A,B,C,etc...)?yes, right now i am giving input to :DEPT like a,b,c. But the way i am input the data is wrong?If :DEPT field (eg: A,B,C,etc...)? has such non-numeric values then it will not work because the IN clause in such a scenario will be looking for something like:
    emp_dept in ('A', 'B', 'C')Hope this helps
    Best Regards
    Arif Khadas

  • Change the Default_Where in 9iDS

    I want to execute this code in the trigger "WHEN-BUTTON-PRESSED":
    DECLARE
         item_value varchar2(30);
         where_clause varchar2(30);
    BEGIN
         item_value:='12';
         where_clause := 'where type='''||item_value||'''';
              set_block_property('bookinformation',default_where,where_clause);
              go_block('bookinformation');
              execute_query;
    END;
    ...but when I press the button I obtain the error message "FRM-40505".-
    What is wrong?

    Call DISPLAY_ERROR and see the query string that has been generated - usually there is simply a problem with the number of quotes

  • Set_block_property does not called the query from the where clause

    Hi all,
    I have two blocks in the Oracle form 6i. Master link with the detail. Because of the data is quite huge if I have the auto query when the form is loaded hence I have two enter parameter created of From_date and To_date together with button to execute the query when that two parameter is being filled.
    I have the following quotes in the button of when-button-pressed :-
    BEGIN
    set_block_property('act_vw_sale_comm', default_where, 'invh_dt >='''|| to_date(:act_vw_sale_comm.fdate,'dd/mm/yyyy') ||''' and invh_dt <= ''' || to_date(:act_vw_sale_comm.tdate,'dd/mm/yyyy')||'');
    go_block('act_vw_sale_comm');
    execute_query;
    set_block_property('act_vw_sale_comm', default_where, '');
    END;
    However, nothing being displayed when I click on the button. Anything wrong on the above statement ? Please help me. thanks.
    Rgds
    Lim

    BEGIN
    go_block('act_vw_sale_comm');
    set_block_property('act_vw_sale_comm', default_where, 'invh_dt >= '''|| :FDATE ||''''' AND invh_dt <= '''|| :TDATE ||'''');
    execute_query;
    --set_block_property('act_vw_sale_comm', default_where, '');
    END;
    Now, I have the above statement, but still the same when try to execute the query, this time, the screen execute but does not show anything and close my form straight away. Why!
    Anyone can help me?
    Thanks
    Lim

  • Order_by in set_block_property returns ORA-01785

    Hello.
    We have a problem with using function in set_block_property with order by when using union sentence.
    Our code looks like:
    set_block_property('block', default_where, 'id = '||:item||'
    UNION ALL
    SELECT ROWID,column1,column2,column3,... FROM table WHERE
    id = '||:item);
    set_block_property('block', order_by, 'function(column1), column2');
    Form returns error: ORA -01785 : ORDER BY item must be the number of a SELECT-list expression
    We know, that with union we should use numbers in order by instead of column names. But it doesn't work.
    If we do not use UNION, then order_by with function works.
    How can we solve this problem?
    Thanks.
    Edited by: DejanH on Sep 10, 2008 8:03 AM

    Not sure you can ever get Forms to handle that complicated a query using default block processing.
    Since it looks like your block is display-only, I would create a record group with the query and order by, populate it, and then step through the record group row-by-row moving the values to the block (which would then be a control-block rather than a base-table block). Of course, if your query selects more than a few hundred rows, this is not a good solution.

  • Pre-query set_block_property Default Where

    I need some information regarding
    SET_BLOCK_PROPERTY , DEFAULT_WHERE
    How it works
    I am using this code
    SET_BLOCK_PROPERTY('bank_recon',
         DEFAULT_WHERE, 'v_bankcode= ''' || :button.bankcode     || ''' and ' || 'v_chq= ''' || :button.chq_no ||
           '''');   but when I add one another condition not work
    SET_BLOCK_PROPERTY('bank_recon',
         DEFAULT_WHERE, 'v_bankcode= ''' || :button.bankcode     || ''' and ' || 'v_chq= ''' || :button.chq_no ||
                                                                                                                                                 ''' and ' || 'recon is null'||
           '''');   Please guide me and inform me how it is work... how to use its *' '*

    try
    DECLARE
        v_sql VARCHAR2(300);
    BEGIN
        v_sql := 'v_bankcode= ' || '''' || :button.bankcode || '''' || ' and v_chq= '  || :button.chq_no || ' and recon is null';
        SET_BLOCK_PROPERTY('bank_recon', DEFAULT_WHERE, v_sql);
    END;if you have doubt about the syntax, you can check it by showing a message like
    message('sql=' ||  v_sql);PAUSE;

Maybe you are looking for

  • What's the best storage solution for a large iLife? RAID? NAS?

    I'm looking for an affordable RAID storage solution for my Time Machine, iTunes Library, iMovie videos, and iPhoto Library. To this point I've been doing a hodgepodge of external hard drives without the saftey of redundancy and I've finaly been bitte

  • How to print Checks in certain order than by Vendor Numbers?

    We need to print certain batch of checks in different order than SAP standard(Vendor Number), is there anyway to make SAP to print them in different order? Thanks in advance for the assistance. Points will be awarded.

  • I can't get my itunes to launch!

    I have uninstalled itunes, redownloaded, and it worked the first time it launched.  When I closed out and tried to reopen it, it will not reopen.  I have updated Quicktime as well.

  • Help in UDF

    Hi, Need ur help in creating UDF, i have source fields in Order IDOC under subsegment EDP35 of EDP01 segment. QUALZ CUSADD CUSADD_BEZ and target fields: RT RU RC ET I tried graphical maping as follows: 1) If Qualz = 001 and CUSADD exists then RT else

  • I upgrade my phone to iOS 6.0 and there is no YouTube   Now

    Helloo