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.

Similar Messages

  • Enter_query and execute_query

    hi all,
    i have a form containing a master-detail, the first thing i do i enter values in 2 fields (of the block A) and i validate (this record already exists), after validate i show in the same form other fields of the block A for update and i mask the first button "validate" and i show another button "validate" to commit changes in block A and Inserting values in detail block B
    the problem:
    when i validate (the first button "validate") i get the message: 'would u save the changes and i must click on "no" in order to show the other fields, so how can i do this without having this message?
    i have enter_query in new-form-instance and execute_query in the first button "validate"

    hai, ali
    just add a parameter to u r execute query procedure.
    EXECUTE_QUERY(NO_VALIDATE);
    this will not validate u r block data and gets total record values.
    if this not solves send complete problem description to my mail.
    hope it works for u.
    bye.
    Raj
    mail : [email protected];

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

  • Webutil and execute_query

    Hi All, Here's my problem for today.
    I have a tabular datablock with over 30 data items in each row that is populated by Execute_query.
    What I want to do is take results of that query and use Web_util and download the data to my desktop.
    I've done something similar by using a cursor, looping thru it and writing the data out, line by line using the "client_text_io.put_line" command and specifying the individual data items.
    Is there a way to be able to capture the results of the execute_query and in one swell foop use web_util to transfer this data to my desktop?
    Thanks,
    Larry

    If you must use the result of a execute query in a block you can use GO_BLOCK('block_name'), FIRST_RECORD and NEXT_RECORD to loop over the records and then use put_line to write the content of the block's fields to a file.

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

  • Enter_query and execute_query progrmatically

    I would like to place a button on my form that esential will
    allow the user to press this button rather then hitting F7 and
    F8 to query. The problem is that when you got into enter_query
    mode you can not navigate to another block which then means that
    I when i click my button to execute the query I am not able to.
    It is not feasible to place the button as the same block i want
    to query because of the fact that it displays multiple records
    which means it would display my button 5 times. How can I
    achieve this?
    Thanks
    Spencer Tabbert
    null

    You could use stored procedures and pass a where clause to the
    query_procedure. Oracle's has limitations in handling operators
    in enter_query mode.
    cesar (guest) wrote:
    : Spencer Tabbert (guest) wrote:
    : : I would like to place a button on my form that esential will
    : : allow the user to press this button rather then hitting F7
    and
    : : F8 to query. The problem is that when you got into
    enter_query
    : : mode you can not navigate to another block which then means
    : that
    : : I when i click my button to execute the query I am not able
    : to.
    : : It is not feasible to place the button as the same block i
    want
    : : to query because of the fact that it displays multiple
    records
    : : which means it would display my button 5 times. How can I
    : : achieve this?
    : : Thanks
    : : Spencer Tabbert
    : You should place your button in a control block, maybe in a
    : horizontal toolbar canvas.The button will work for any block
    of
    : your form.
    : If you need an example,you could send me an e-mail.
    null

  • Values are not populating...

    After selecting the data from LOV the values are not populating in the respective fields.
    i've checked the 'LOV' no problem in that,but im think below coding have a problem.
    declare
         b boolean;
    begin
         :global.job:=null;
         clear_form(no_validate);     
         b:=show_lov('view');
         :GLOBAL.ADDNEW1:=0;
    --     go_block('JOB_CARD_MAIN');
         GO_ITEM('JOB_CARD_MAIN.BRANCH_CODE');
         set_block_property('job_card_main',default_where,'job_no='||chr(39)||:job_card_main.job_no||chr(39));
         execute_query(no_validate);------after this line get execute the values get disappear from the field
         insert into da.mylog(username,tname,mdate,oper) values(user(),'Job Creation',sysdate,'S');
         commit;
    end;
    Pls help..

    Which trigger do you have this code in? I'm guessing it is a Key-ListVal trigger.
    Have you tested the WHE RE clause in SQL*Plus to ensure it returns a record set? Most likely, the query returns no rows which could explain why the block is empty. Also, why are you clearing the entire Form instead of just the JOB_CARD_MAIN data block? Perhaps you should try:
    Go_Block('JOB_CARD_MAIN');
    Clear_Block(NO_VALIDATE);Also, the EXECUTE_QUERY built-in does not have a NO_VALIDATE parameter. It only supports the following parameters:
    ALL_RECORDS
    FOR_UPDATE
    or the combination of the two (ALL_RECORDS,FOR_UPDATE). It also allows you to set the Locking mechinism by passing the parameter NO_WAIT.
    Just a suggestion, try your query in SQL*Plus to make sure it produces a record set and Comment out all the extra stuff in your code and only keep the SHOW_LOV, CLEAR_BLOCK, SET_BLOCK_PROPERTY and EXECUTE_QUERY to see if a row is returned. If yes, then add the rest of your code back one line at a time.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Execute_query error

    Hi master
    Sir
    I use enter_query through button and give 10 in deptno textbox
    But I execute_query through button no give result
    An use form menu then give result easily what happen
    Enter_query code
    Go_block(‘emp’);
    Enter_query;
    execute_query code
    Go_block(‘emp’);
    execute_query;
    and
    execute_query code
    execute_query;
    and how use option button
    please give me idea
    thanking you

    Hi Karen,
    We have just run into this issue...trying to find out more, but the Crystal Report developer stated...
    "When I alias a table in crystal and use a field from that alias I get the following error:"
    Database connector error: /CRYSTAL/OSQL_EXECUTE_QUERY returned: subrc: 4. message "CONTENT-0-0" has already been declared.
    Was this the same  OSQL_EXECUTE_QUERY error you received? and by chance did you get it resolved.
    Also having the resource go through the checks on the transports per Ingo.
    Thanks.
    Kevin

  • Enter_qurery/execute_query... its very URGENT!!!!

    hi sir/madam,
    i have a problem with execute_query...ENTER_QUERY is working fine...But EXECUTE_QUERY not giving any response...the code written for both are given below...
    first trigger
    go_block(<block name);
    enter_query;
    second trigger
    go_block(<block name);
    execute_query;
    wht 2 do ??? but Ctrl+ F11 for execution is working fine...

    hi,
    created a block using wizard..and i'm trying to find a record. i used Enter_query to enter a value and Execute_query for retrieval. the two queries r placed in two buttons.The Enter_query is working fine, but no result is comming from execute_query, execute_query will work if i press CTRL+ F11.
    regards.

  • Two Master  and two details block problem

    Hi,
    I am getting problem in displaying the correct records on one of the detail block. There is one main master block 'A' and then it has one details block 'B' and then this detial block 'B' has got two details blocks 'c' and 'D'. I form different queries based on the value selected at detail block 'D'. Now i go to ,aster block and execute_query then it fetche the correct record at master block not on detail block 'D'. I have one anmoly in Dtails Block D and Master block B that they are joined with a common field not on the basis of proimary key and forign key. Please sugget

    Hi,
    When you establish the relations using the references, then oracle will look for the parent key in both the parent tables. Either you need to remove the foreign keys or change your db design to add one more table and have one-one parent child relationships.
    HTH
    Regards,
    Badri.

  • Runtimechanges for some block- (e.g. Records_Displayed) and item-properties?

    Hi there,
    is it ever planned by Oracle to allow runtime changes (set_block_property and set_item_property) for:
    - the Block-Property: Records_Displayed
    - the Item-Property: Items_displayed
    - the Item-Property: Canvas
    - the Item-Property: Hint_Text
    - the Item-Property: Mirror_Item
    - the Item-Property: default_value
    I've read the 9.02 Docs and all of them has to be set at designtime.
    For building more sohisticated UIs we would need to set them at runtime.
    Thanks, Markus

    I suppose you are starting in programming with developer.
    All who had tried to do nice forms, had a lot of problems.
    But you need to find a way to do it.
    For example, you could create to canvas and display one of them in some case.
    In when new form instance
    or when create record in the block you can define de default vaule of the item.
    If you are new I suggest you give a check to all the triggers, and most of them can be
    create at item, block or form level.

  • How do I select more records using data blocks, set_block_property

    Hi, I am new in oracle forms builder. I want to fetch more then one records using set_block_property and data block. please help me. How do I select more then one data? I don't have any Idea about Oracle
    Please Help its urgent

    What is your Forms version?  Is your form in "Form" (single record) or "Tabular" (multi-record) layout?  You can't use the SET_BLOCK_PROPERTY() built-in to change the number of records that are displayed - this must be done during design through the Forms Builder.
    What exactly are you needing to do?
    Craig...

  • Regarding download customer.fmb and order.fmb

    Hello,
    Can you please let me know from where can i download customer.fmb and order.fmb for oracle forms 6i.
    Please explain that when do we use set_BLOCK_PROPERTY, i have gone through documents there are few examples and explaination of syntax but still i'm unable to understand when it to be use in menu or forms.
    Thanks

    Then we need to know what document you are reading so we know what files it references. If the document is a propietary document, you may have to go to the author of the document to get the files. For example, if you are studying from a copy of an Oracle Training book, you will need to contact Oracle to get copies of the sample forms. i got the pdf from internet the name of document is "*Oracle Forms Developer Build Internet Applications 2-Volume 1 Instructor Guide.PDF 40034GC10 Production 1.0 May 2000 M011398*" and here is no link to attach the file so i'm unable to send you that document.
    In above document, i'm going through " *Practice 1 and 1 Create a new menu module.*"
    some following details are given below:-
    1 Create a new menu module.
    a Using the following screenshot as a guideline, create a new menu
    module called M_SUMMITXX where XX is your student course
    number.
    here is figure regarding with menu editor, we have to followup to that figure
    File Menu and given property of file menu like below but it is in tabular form so i'm unable to copy paste here exactly the same:-
    Label_Menu     Item_Type      Command_Type      Menu_Item_Code      Visible_in_Menu       Visible_in_Horiz._ Menu_Toolbar       icon_Filename
    Save Plain PL/SQL DO_KEY(’COMMIT_FORM’); Yes Yes Save
    Clear Plain PL/SQL DO_KEY(’CLEAR_FORM’); Yes Yes Abort
    Null1 Separator Null Yes Yes
    Exit Plain PL/SQL DO_KEY(’EXIT_FORM’); Yes Yes Exit
    Null2 Separator Null No Yes
    like above the all property is given for all menu items and then after some instruction is given like below:-
    b Save as M_SUMMIT and compile the menu module.
    c Attach the menu module to the ORDERS form.
    d Save and compile the form module as ORDGXX where XX is your
    student course number.
    e Run and test your ORDERS form.
    *2* Add pop-up menus to the CUSTOMERS form.
    a Open the CUSTOMERS form module. Save as CUSTGXX where
    XX is your student course number.
    b Copy the EDIT_MENU menu from your M_SUMMIT menu
    module to your CUSTOMERS form. Attach this pop-up menu to the
    Comments item.
    c Save and compile the form module. Deploy your form to the Web to
    test.
    In this example, the SET_BLOCK_PROPERTY built-in is setting the ORDER_BY property of the S_ORD data block so that records displayed in the block are ordered by the SALES_REP_ID column (block item).
    For more information about the SET_BLOCK_PROPERTY search the Forms Help system; click the Index Tab and then type SET_BLOCK_PROPERTY and open the "SET_BLOCK_PROPERTY built-in" topic. As you review this help article it is helpful to have the property pallet open for a data block. Then you can select a property and press F1 to get detailed information about the property.i want to ask that when do we need to use SET_BLOCK_PROPERTY. in which case, because i also read to forms6i.pdf *"Form Builder Reference, Volume 1 Part No: A73074-01"* but i'm unable to understand that how to use and when to use.
    there is syntax given only but not given the situation.
    NOTE : Please let me know how to attach document then i can send to you, what document currently i'm following or please let me know your mailid so i'll email to you.
    Thanks

  • HOW: To save/refresh data from different forms but in same session

    Hi
    I have 2 screens
    Screen-1
         Tabluar form with 10 rows and each row corresponds to one edit image
    Screen-2
         Forms type form with multiple text items and list items and one OK and cancel button
         If I click on OK button, whatever I enter in screen-2 is updated but till now no commit only EXIT_FORM and the screen is going back to Screen-1
    In Screen-1 I have written trigger When-Wiindow-Activated, which has to refresh the screen-1 values with the changed values from above screen-2
    BUT this is not happening. (I am using SET_BLOCK_PROPERTY... and EXECUTE_QUERY to refresh, by passing the query string)
    Also I have one save button in Screen-2 which should commit whatever I have updated in Screen-2 (once or muyltiple times)
    I am opening the Screen-2 from Screen-1 by using OPEN_FORM built in with form name and ACTIVATE,NO_SESSION and also the parameter.
    Please let me know if I am doing any mistake in calling or some properties need to be set.
    I assume that, as the aplication is in the same session then the newly edited record in screen2 should get reflect in screen-1, and should get saved once I click on save button in screen-1 (FORMS_DDL('COMMIT'))
    regards
    JC

    I assume that Screen 2 is not based on table as it doesn't prompt you "Do you want to save chages" on exit.
    So you probably just updating with update statement.
    You will need to call POST; before exit_form in screen 2.
    Post;
    Exit_Form(NO_COMMIT, NO_ROLLBACK); Also in screen 1, instead of OPEN_FORM and re-query in WHEN-WINDOW-ACTIVATED, I would suggest to use call_form and re-query just after call_form:
       CALL_FORM('xxx',no_hide, no_replace, no_query_only, pl_id);
       SET_BLOCK_PROPERTY ('YOUR_BLOCK' ...
       GO_BLOCK('YOUR_BLOCK');
       EXECUTE_QUERY;

  • Where Clause in the Forms doesn't work

    Hi,
    I am trying to execute a query in base table block. The block property 'Query allowed' is TRUE and WHere clause is null;
    I used 'SET_BLOCK_PROPERTY' and set the where clause. Did a GO_BLOCK and EXECUTE_QUERY;
    The block brings all records as if there is no where clause. TO make sure I put up a message 'GET_BLOCK_PROPERTY' to see the where clause. It showed correct where clause.
    null

    Setting the where clause the way you did usually works, and it worked fine for me several times.
    Yet, a couple of days ago I ran into something that defies my logic:
    1) when using the "=" operator, it fetched me several records that satisfied the condition
    2) when using the "<=" or ">=" operator it fetched only one of the records that satisfied the condition: the one that is strictly equal.
    I tried using the pre-query trigger, but to no avail.
    I'm looking forward for your succes.
    null

Maybe you are looking for