Query forms based on detail block

My question is pretty simple: Is it possible to query a form (Forms [32 Bit] Version 6.0.8.11.3) based on a detail block? Let me explain my problem! I have a table called REQUISITION and of its field is STATUS_CODE. Then I have another table called STATUS that have the following fields: CODE, NAME, DESCRIPTION, PHASE, etc. The join condition between REQUISTION and STATUS is REQUISITION.STATUS_CODE = STATUS.CODE. On my form, all of the fields come from table REQUISITION but the problem is that we have over 30 different status and my user can't remember their names and phase. So I inserted two display fields on the forms and wrote a post-query trigger to populate the field with their corresponding names and phases. But now my end user are complaining that the fields don't allow queries to be performed which prevents them to use a query to know all requisitions that are on phase "Procurement" which corresponds to four different status_code. So I though in inserting the fields PHASE and DESCRIPTION into table REQUISITION and write a trigger that would populate those field every time the STATUS change but that would cause a problem when lets say STATUS 01 is part of PHASE "Procurement" then comes next week the company decides that is not longer part of phase "Procurement" but now it is part of PHASE "Purchasing" they would go the form based on table STATUS and change the field PHASE of the corresponding STATUS that they want. But now I have this data on another table holding information that is no longer valid. Sure I could write another trigger to change field REQUISITION.STATUS_PHASE whenever there is a change on STATUS.PHASE but wouldn't that be too much bookkeeping? Would be so much easier if I could query my forms based on the detail block (this case table STATUS and master block table REQUISITION)?
thanks so much in advance for any thought! Btw, I am open to other suggestions too!!!!!
gleisson henrique

if I understood you correctly, you can do this manually. what I mean is,
when the end user picks phase "Purchasing", you can change the where clause on the master block and execute the query to get the desired results
e.g.
v_cod varchar2(200) := 'STATUS_CODE in (select code from status where phase = ''Purchasing'')';
begin
set_block_property(requisition_blk,default_where,v_cod);
execute_query;ofcourse you have to change "Purchasing" in the previous code to the item that holds the user inputs
hope this is helpful
Edited by: Mohammed H. on Sep 19, 2008 6:45 PM

Similar Messages

  • Master-Detail relationship and querying back from the detail block

    Hello friends,
    Using oracle forms 6i. I have a multi data block. On the block there is a header and detail section. There is master detail relationship present in these blocks. I have a sequence defined, which generates an auto-number.
    Now in the detail section say I have 4 records all of which are say invoices and I am populating the details about it. On the 'save' button I have defined a logic which generates an auto- number or a unique number for all the 4 records in the detail section. The unique number is shown in the header section in a text-field.
    Now when I query (F11 and then Ctrl+F11) with the help of the unique number i see all the 4 records under it in the detail section. But when I query with the help of one of the 4 records in the detail section it says "fetching more than a single row." I know the same unique number is there for all the 4 records and in the header section I am displaying "number of items displayed" to be 1. That is why the error. But I want that to remain one. How exactly can I develop this functionality of querying the unique number in the header section from the detail block?
    Please help as soon as possible.

    Hi,
    I'd suggest to check this tutorial:
    http://www.oracle.com/technology/obe/obe_as_10g/bi/forms/formsmasterdetailobe.htm
    Having a relationship between data blocks, coordinates dml actions in both, so no coding is needed to save/update/delete records, forms built-ins do the work.
    hope this is useful,
    Hugo

  • Execute_Query in MASTER-DETAIL form queries the DETAIL block...?

    I'm using Oracle Form Builder with a Master-Detail relationship, I have a WHEN-NEW-FORM-INSTANCE trigger which runs 'EXECUTE_QUERY;' but it is returning records from the Detail block rather than the master block. Can anyone tell me how to return records from the master block?
    I have no idea what the block name is. I've tried the data block name and the title above the block and both say they are undefined.
    Thanks.

    Welcome at OTN
    Please Before posting on this forum please read
    I have no idea what the block name is. I've tried the data block name and the title above the block and both say they are undefined.At Layout Editor expand the Data Block nodes. Here you will get the block name.
    Check in When-New-Form instance trigger, is there any code like
    Go_Block('details_block');IF yes , delete this line...
    Hope it helps...
    Hamid
    If someone's response is helpful or correct, please mark it accordingly.

  • Customize af:query form based on ejb entity data control

    Hi all,
    on my application i have a simple table with an af:query form to search data.
    One of the requirements is to have one of the search criteria be displayed and filled depending on certain conditions.
    For example :
    if the user has a certain role, the field should be read-writable but not filled so that the user can specify whatever he wants.
    otherwise the value of the criteria should be something like the username but not be displayed (or at worse read only). Of course in the later case the user couldn't also add in when using the advanced query option.
    How can i achieve this ? Do i have to write a custom QueryModel or could i retrieve the one via #{bindings.ImplicitViewCriteriaQuery.queryModel} and browse this object to remove/update the criteria ? Is there a clean declarative approach to this use-case rather than programmatic ?
    I tried the second solution (not sure if it's the cleanest way) but at some point i end up with a ConcurrentModificationException when removing the criterion from the ConjuctionCriterion list.
    any idea ?
    btw i'm on jdev 11.1.1.5.0
    thanks
    -regards
    Julien.

    Well, the databound query created a sql where clause which is added to the base sql statement. If you don't have a VO where should the where clause been added to?
    The view criteria are also more like a dynamic where clause and I don't think you can easily mimic the framework is you don't have a VO behind it.
    Timo

  • Searching master block based on value in detail block

    I have two blocks on a form. A master block for purchase orders and a detail block for the line items. I need to provide users with the ability to search the purchase orders based on the values entered into the detail block (line items), during the query entry. I am considering to check to see which block the cursor resides by using the :SYSTEM.CURSOR_BLOCK variable, then retrieving the value from the current item and running a query, using that query. The problem is that I am not very familiar with Forms and do not know how to implement my idea. Any ideas?
    null

    I copied you an example from metalink. Hope it will help.
    Doc ID:
    Note:109583.1
    Subject:
    How to query a Master record from a Detail Block
    Type:
    BULLETIN
    Status:
    REVIEWED
    Content Type:
    TEXT/PLAIN
    Creation Date:
    22-MAY-2000
    Last Revision Date:
    03-AUG-2001
    PURPOSE
    ------- To query a master record from a detail record. DESCRIPTION
    =========== The user would like to enter a query criteria in the detail block
    and then query the master record based on the above user input. SOLUTION
    ======== Create the master and detail blocks and the relationship in the usual
    manner. We will consider here the blocks DEPT and EMP based on the
    SCOTT schema. 1. Create a KEY-ENTQRY trigger at the block level of the detail block
    (EMP) and add the following code in it : GO_BLOCK('dept');
    CLEAR_BLOCK(no_commit);
    GO_BLOCK('emp');
    ENTER_QUERY; 2. Create a KEY-EXEQRY trigger for the detail block and add
    this : EXECUTE_QUERY;
    :global.deptno := :emp.deptno;
    :global.flag := 'T';
    GO_BLOCK('dept'); This will store the value of the deptno (primary key) in a global variable
    :global.deptno and set another global variable :global.flag to 'T'. This
    will be explained as we progress. 3. Create a WHEN-NEW-RECORD-INSTANCE trigger for the detail block
    and add the following : -- This is used to populate the MASTER block with the corresponding
    -- record whenever the user navigates through all the records in the
    -- DETAIL block if get_record_property(:system.cursor_record,:system.cursor_block,status) = 'QUERY' then
    SELECT rowid,deptno,dname,loc
    INTO :dept.rowid,:dept.deptno,:dept.dname,:dept.loc
    FROM dept
    WHERE deptno = :emp.deptno; -- This is to set the status of the record populated
    -- to QUERY and not to create a new record SET_RECORD_PROPERTY(1,'dept',status,QUERY_STATUS);
    end if; 4. Create a WHEN-NEW-BLOCK-INSTANCE trigger for the master block again
    and add this : if :global.flag = 'T' then -- set the variable to a different value
    :global.flag := 'F';
    :dept.deptno := :global.deptno; -- This will query the master table for the record based on the
    -- deptno of the detail table which is stored in :global.deptno -- For ex: if an employee of department 10 has been queried in
    -- the detail, then the global.deptno will have the value 10,
    -- which is used in the query below to fetch the master record. SELECT rowid,deptno,dname,loc
    INTO :dept.rowid,:dept.deptno,:dept.dname,:dept.loc
    FROM dept
    WHERE deptno = :global.deptno;
    set_record_property(:system.cursor_record,'dept',status,QUERY_STATUS);
    GO_BLOCK('emp'); end if; EXPLANATION
    =========== Actually in the above method we are using the base table blocks as a
    non-base table block when we query the master from detail. We are
    displaying the master record fetched from the table based on
    the query supplied in the detail. So after the fetch, if we clear the
    block or form then we get a "Do you want to save the changes you have made"
    alert. So in order to supress this while entering a normal master-detail
    query, we have created the global variable, :global.flag. There is a limitation though, if you query detail records and then
    navigate to the master block and then press the down arrow( i.e.,
    navigate to the next record) and then presses the up arrow to
    navigate back to the same record, then the detail records that
    were originally populated will change and a new set of records will
    get displayed. This is because the normal master-detail query is
    taking place during MASTER record navigation. This can be controlled by creating a flag (global variable) and setting
    its value and thus preventing the user from navigating to the next master
    record. Do the following : 1) In the KEY-EXEQRY trigger of the detail add the following :global.control_master := 1; 2) Create a KEY-EXEQRY for the master and add this : :global.control_master := 0;
    EXECUTE_QUERY; 3) Create a KEY-DOWN in the master with the following in it: IF :global.control_master <> 1 THEN
    down;
    END IF; Declare all the global variables before running the Form. RELATED DOCUMENTS
    Note:611.1

  • How to query the master block based on one of the values in detail block

    Hi,
    In version 6i forms, I have a field in data block which is not set as a database item. I am using that field to store a value from detail block. If I want to query the form using that field (which represents one of the values from detail block), how do I do that? Any pointers?
    TIA,

    Do you want to query a master, which contains a specific detail? If so, here's an example how you could do it with a PRE-QUERY-trigger:
    DECLARE
      vcQuery VARCHAR2(4000);
    BEGIN
      IF :MASTERBLOCK.THE_DETAIL_SEARCH_ITEM IS NOT NULL THEN
        -- Build up an exists Sub-Query
        vcQuery:=' MASTERBLOCKID IN (SELECT FK_TO_MASTERBLOCK FROM DETAILTABLE WHERE DETAIL_COLUMN=''' || :MASTERBLOCK.THE_DETAIL_SEARCH_ITEM|| ''')';
      END IF;
      SET_BLOCK_PROPERTY('MASTERBLOCK', DEFAULT_WHERE, vcQuery);
    END;

  • Autofill detail block based on query

    Hi experts/Gurus
    I have 3 tables
    1-pr_mst
    2-pr_trn
    3-hr_mst
    Em_code is a common key between theses tables.
    on my form table 1 and 2 are the base main tables, due to the relationship, when i enter em_code on table 1 and query it, it shows data on both the table. Its a normal behavior in Master Detail block in forms.
    When user enter em_code at form and there is no data found in table 2, obviously it show blank data block related to the table 2 and shows data in table 1 block, now i want an em_code details which stores in the table 3 automatically load in memory and populated in detail block.
    Is it possible ? and how can i do this. suggest me a best or anybody can give example on emp/dept
    regards
    Anwer

    I'm not sure if i understand you correctly. You want to have an additional relation between block 1 and block 3? If so, just create it, each block can have more than one relation as master.

  • Update detail block based on FROM QUERY

    I have 2 blocks in master-detail relation. The master is based on a table, the detail on from query. The Insert works fine... but whenever i want to update any field from the detail block, the items (text, lists, whatever) don't allow any updating.
    Is there some workaround?
    Thank you for the help
    NR

    RTM on blocks based on from-query.
    If I recall well, it says that you shoud write the DML code in on-insert, on-update and on-delete triggers - and, anyway, if I do not remember well the manual, that's what I do.
    So, the on-insert trigger should have an insert into <my_dml_table>...
    The on-update trigger sould have an update <my_dml_table>... where ... And there's a thing: you may have the rowid of <my_dml_query> fetched - which would be the best - or use some primary key for that table for update (not so good performance).
    The on-delete trigger somewhat like the on-update trigger.
    Moreover, I believe it would be better to have procedures for on-insert, on-update and on-delete grouped in one package in the database - again, this is what I use to do.

  • Oracle Forms : Master Detail : Cannot query detail block

    MY requirement is: when user enters records in master block, the corresponding records should be displayed in the detail block. (Detail block is just for viewing).
    Master block is a database block based on a custom table. All fields are enetereble in this block.
    Detail block is a a database block based on view which is built joining the custom table(on which master block is built) & a standard table. None of the fields in detail block are editable. they are just display only. For detail block, set the Key Mode=Non-Updatable, Enabled a field as Primary Key.
    I have created a relation between the 2 blocks. (Deferred=No, AutoQuery=No, Delete Record Behaviour=Isolated.). There is a join between master table & this view.
    But when I enter record in master block & save. the detail block records are not displayed. (Message : No Navigable Items in Detail Block).
    Yes, there are no navigable items in detail block, because its just for viewing purpose. How can this be achieved.
    Thanks,
    Naveen

    Thanks for your inputs. I got the solution for this. Earlier all items in the block were DISPLAY_ONLY. Now, I have selected them as TEXT_ITEMS (even though they are not updatable). It is working fine now. Thanks.

  • Query based on a non-database item in master/detail block

    Hi,
    I have a master/detail block, and in the master the block in have non database control item which displays the user name. Now i would want to retrive all the master/detail records based on the control item. Is that possible? How can i do it?
    Any help would be appriciated.
    Thanks
    Kavitha

    use the set_block_property (default_where) and the execute_query built-ins. more info in the online help

  • FRM-40654 error in master-detail form while deleting record in detail block

    Hi,
    I am facing an issue in a custom form which is a Master-detail form while deleting a record in detail block. It is giving an error "FRM-40654 Record has been Updated by another user. Re-query to see change". I have checked the record is matching with that in database.
    Can anyone help on this.
    Thanks In Advance,
    Midhun

    Hi jan,
    master block is based on Table "A" and detail block is based on a View "X".
    View "X" definitions includes the tables "A","B","C" etc..
    Now I have tried removing table"A" from view "X", even then the same error is ocuuring but the lock is happening on table "B" instead of "A"
    Thanks,
    Midhun

  • Problem in query detail block

    hello all,
    i have a form having master and detail block. in master we have store_cd and location code(primary key in master table),
    based on that detail recrds fetch in detail block. perfectly fine. but when i query within detail block records then it show no record found. please tell me what can be wrong.
    detail table primary key is (store_cd, location_code and storage_co) , in realtion i mentioned
    masterblock.store_cd=detailblock.store_cd and masterblock.location_cd=detailblock.location_cd
    Thanks
    yash

    yes, there are records in detail table... table structure(master and detail block)
    SQL> desc ivt_store_mst
    Name Null? Type
    STORE_CD NOT NULL VARCHAR2(3)
    STORE_DESC NOT NULL VARCHAR2(25)
    LVL_REF_CD NOT NULL VARCHAR2(6)
    STORE_TYPE VARCHAR2(2)
    Primary key(store_cd,lvl_ref_cd)
    SQL> desc ivt_storg_mst;
    Name Null? Type
    STORE_CD NOT NULL VARCHAR2(3)
    STORAGE_SRL_NO NOT NULL NUMBER(10)
    STORAGE_CD VARCHAR2(10)
    ITEM_CD NOT NULL VARCHAR2(10)
    BAY_NO VARCHAR2(10)
    SHELF_NO VARCHAR2(10)
    ROW_NO VARCHAR2(10)
    TIER_NO VARCHAR2(10)
    BIN_CARD_NO VARCHAR2(10)
    INSERT_DT DATE
    GRN_NO VARCHAR2(12)
    GRN_FIN_YR_CD VARCHAR2(8)
    PLEVEL_REF_CD NOT NULL VARCHAR2(6)
    PGRN_LEVEL_REF_CD VARCHAR2(6)
    Primary key(store_cd,storage_cd, plevel_ref_cd)
    relation property is: noo-isolated
    deferred: false
    autoquery: false
    block join condition based on detail_blk1.stor_cd=masteblk.store_cd
    when i query from master block , ALL detail blocks ITEMS are displaying. but when i query again among detail block items then, no record found base on query field(detail blk: item_cd which is base table field).
    when i query in detail block for all records then Every time only one item display with same item_cd...
    if further some info required, plz mention

  • Recommended best practice to fetch detail block based on procedure

    HI
    I am creating a detail block (Dept)based on procedure which will be populated from the value from master block 'Emp'.
    For example,
    Detail block 'Dept' will be populated by calling procedure populate_detail(:emp.empno in number,dept.deptno out number) .
    But what are the triggers I need to call to populate detail block and at which level?
    I was thinking to call a WHEN-MOUSE-DOUBLECLICK on master block 'Emp' level to populate the detail block 'Dept' by calling the procedure and passing emp.empno as the parameter whenever the user moves from one master record to another.
    Please advise.
    Thanks in advance.

    Download the forms 6i examples CD from the OTN website

  • Query mode of Master Detail Form

    I have a master-detail form.
    I'm passing parameters to that form to autoquery data.
    Everything works fine but "Next" button in a detail block.
    I'm getting:
    An unexpected error occurred: ORA-06502: PL/SQL: numeric or value error: NULL
    index table key value (WWV-16016).
    After autoquery LASTIN_SET variable of DEFAULT block is set "5" (number of rows in detail block).
    When I click on "Next" button LASTIN_SET variable is set to "0" instead of "5" and that causes a problem.
    So, somehow LASTIN_SET is not preserved between clicks.
    In fish_size_form master-detail form
    ... before displaying the page
    shrimp.p_set_parameter_fish_size(p_session,
    p_block_name,
    p_object_name,
    p_instance,
    p_event_type,
    p_user_args
    This is a code of shrimp.p_set_parameter_fish_size
    p_session in out nocopy portal92.wwa_api_module_session,
    p_block_name varchar2,
    p_object_name varchar2,
    p_instance varchar2,
    p_event_type varchar2,
    p_user_args varchar2
    is
    sess_store portal92.wwsto_api_session;
    status varchar2(80);
    station varchar2(80);
    date_time varchar2(80);
    sample varchar2(80);
    species_code varchar2(80);
    form_state varchar2(100);
    begin
    form_state := p_session.get_value_as_varchar2(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => '_FORM_STATE');
    if form_state = 'QUERY_AND_SAVE' then
    sess_store := portal92.wwsto_api_session.load_session(
    p_domain => 'sfnrc',
    p_sub_domain => 'shrimp');
    status := sess_store.get_attribute_as_varchar2(p_name => 'status');
    if status = 'apply' then
    station := sess_store.get_attribute_as_varchar2(p_name => 'station');
    if station is not null then
    p_session.set_shadow_value(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_O_S_M_O_STATION__ID_K',
    p_value => '='||station,
    p_language => portal92.wwctx_api.get_nls_language );
    end if;
    date_time := sess_store.get_attribute_as_varchar2(p_name => 'date_time');
    if date_time is not null then
    p_session.set_shadow_value(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_O_IN__SAMPLE_IN__DATE_TIME_K',
    p_value => '='||to_char(to_date(date_time,'yyyy/mm/dd hh24mi'),'yyyy/mm/dd hh24:mi'),
    p_language => portal92.wwctx_api.get_nls_language);
    end if;
    sample := sess_store.get_attribute_as_varchar2(p_name => 'sample');
    if sample is not null then
    p_session.set_shadow_value(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_OBSERVED_IN__SAMPLE_NUMBER_K',
    p_value => '='||sample,
    p_language => portal92.wwctx_api.get_nls_language);
    end if;
    species_code := sess_store.get_attribute_as_varchar2(p_name => 'species_code');
    p_session.set_shadow_value(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_S_I_PROJECT_SPECIES_CODE_K',
    p_value => '='||species_code,
    p_language => portal92.wwctx_api.get_nls_language );
    sess_store.set_attribute(p_name => 'status',p_value => 'done');
    sess_store.save_session;
    p_session.save_session;
    fish_size_form.wwv_master_gensys_1(
    p_block_name => p_block_name,
    p_object_name => p_object_name,
    p_instance => p_instance,
    p_event_type => p_event_type,
    p_user_args => p_user_args,
    p_session => p_session );
    end if;
    end if;
    end;
    What I'm missing here.
    Aantoliy.

    Say, I click on Update Push button. This will invoke a LOV that will occurs 5 times and then display the header and detail record.
    Even if, I am able to get the records in the canvas, I am not able to update the records of the master. The record_status is in INSERT mode of the header block. Interestingly, if i click 2nd time on update button and then get the records after executing LOV, the query enters the query mode and I am able to update the records then.
    Please suggest how to overcome the problem on a sigle click on UPDATE button.

  • Forms based on query?  Is it possible in Oracle Portal?

    here is my code that i want to use
    SELECT a.first, a.last, b.Position_CD, c.skill_cd, d.team_name, d.team_country, d.club, e.structure_name
    FROM Roster a, Roster_position b, roster_skill c, team d, team_structure e
    where (a.Roster_ID = b.roster_id (+) and (b.roster_id = c.roster_id (+) ) and (a.team_cd = d.team_cd(+)) and (a.team_structure_cd = e.team_structure_cd (+)))
    order by a.roster_id;
    Is it possible for oracle portal to support such a query in a form?
    Oracle portal supports single tables or views...master-detal...and forms based on procedures.
    Since the above query associates with moro then one table..how might one create a form based on that query? Is their a way in oracle portal to create a form and have its record source be based on such a complex query and be able to update and insert data? I know and have tested that it works in Ms Access and i can update and add data in that above query. Hopefully oracle supports this. (*cross fingers*)
    If i cant do what i said above...what advice or suggestions you guys have for me? If i use master-detail it won't work right because i need to involve all 5 tables.
    Any help or comments are greatly appreciated!

    When i made the above query a view and created an oracle portal form. I get this error when I try to retrieve all the records in that view i made above.
    An unexpected error occurred: ORA-01445: cannot select ROWID from a join view without a key-preserved table (WWV-16016)
    What does the "key-preserved table" mean?

Maybe you are looking for

  • Change order in Acrobat Pro XI pdf portfolio

    I can't seem to change the order of my portfolio in Acrobat Pro XI.  My portfolio layout is Click-Through.  When I drag an item on the mini-navigator bar at the bottom and move to a new spot and let go when I have the vertical insertion line, the ite

  • Where can i find a replacement screen for my 30 inch cinema LM300W01

    Hi, my cinema has a broken screen and I would like a replacement screen, i would like to know where i can find one. Can anyone help me, my monitor is in perfect condition and needs a new screen. Thanks [email protected] Message was edited by: crwoo

  • Bug in exception handling.

    Following program: #include <stdexcept> struct X     virtual ~X() {}; struct Y : virtual X     Y() throw (std::runtime_error); Y::Y() throw (std::runtime_error) { throw std::runtime_error("joda"); } struct Z :  Y {   Z() {} int main() try {   Z A; }

  • Creative Suite 5 photo resources.

    I use Creative Suite 5 at my job. Any suggestions on FREE (and copyright free) photo resources that are of print quality? Building up a reference file. Thank you.

  • Cisco finally moves a bit in the WSDL arena

    I just downloaded the axlsql toolkit from my CCM 5.1 and it contains a wsdl + xsd file for Microsoft's wsdl.exe and Axis 1.4. It still doesn't look as problem free as you have to make some changes in the stubs and the readme contains some passages th