Filtering records in a block

Hi all,
I am working on form developed by some other party.
In this form one is control block which contains a combo box.
There is another data block which is based on a table.
When I run the form the records in this block are filtered by the value chosen in combo box.
But I am not able to find the code where this functionality is achieved.
I have checked WHERE clause property of block and the property is null.
Also default_where is not set at runtime.
Is there any other way to filter records in a block?
Thanks in advance.
MK

Hi there,
If there a Push Button on the Control Block to initiate the Execute query for the data block, then the code is in the When-Button-pressed trigger.
If there is no Push Button and if the data block (based on table) changes after a new value is chosen from the combo box, then the default_where or onetime_where code may be hiding behind a When-Validate-item trigger (or some other trigger) in the combo box.
In our application, we have many 'search' fields in the control block. We use a Push Button to build the dynamic where clause for the data block.
Regards,
John

Similar Messages

  • Best way of filtering records in a block

    Hi,
    i have a form with a data block that i want to filter. when i launch the form all records are fetched but then i want to choose the records displayed base on some criteria. Can i apply this criteria to the block so that it is not necessary to requery the database? Which is the best way to achieve this?
    Best regards,
    Bruno Martins

    To save network traffic, you may search from the form memory. Since you first got all deptments and its employees, which stays in form memory. then you should not use set_block_property('..',default_where), which will requery database.
    Then you may add another button inside add ENTER_QUERY;
    then in the when-list-changed trigger,
    GO_ITEM('emp.deptno');
    :emp.deptno := :delptno_list;
    execute_query;
    This way will just search among records in memory. But you may payoff with another ENTER_QUERY button or use default menu bar ENTER QUERY button item.

  • How can I update record in the block that Data Source is PROCEDURE?

    I like use Procedure as the Data Source of block.It's very flexible.
    Usually I do this only query the record,but now I must update record in the block that Data Source is Procedure.
    What next step can I do?Can anyone offer some examples?
    This is example, you goto
    http://www.2shared.com/file/1923834/e0b65fb7/Example.html
    Wait about 30 sec, Click "Save file to your PC: click here",and then you can download it.

    <p>I have written an article about some advanced Forms features.
    Have a look at the 2.3.2 paragraph</p>
    Francois

  • Error in ST05 - trace record pair error block. How to resolve/tackle issue?

    Hello,
    Someone approached me last week in asking me how to resolve an issue in ST05. Basically I used the transaction to filter "inclusive VBPA".
    The error is ....
    Internal error - trace record pair error block 8 link no. 0
    Message no. 0S 026
    Diagnosis
        Each SQL statement is described by two SQL trace records that have the
        same link number. In this case, there are at least three records with the
        same link number.
        The system outputs the number of the block in which the third SQL trace
        record was found, as well as the link number of the records.
    System response
        Program processing continues after the message is displayed. The system
        processes all of the trace records. You should assume, however, that the
        SQL trace in this case is not displayed correctly.
    Procedure
    You cannot correct this error yourself. If you can reproduce the error,
    contact the SAP Hotline.
    SQL trace list editing terminated after 6 errors
    While using the trace I am executing the program that selects VBPA once and, I am assuming, as it goes through the BAPI BAPI_SALESORDER_CHANGE used to unblock a delivery block. I am guessing the problem or source is from the BAPI but do you guys have other insights in what is causing this issue?
    Thanks again, hope to hear from you soon, and good day.

    Our ERP LIVE Production around 11am all users encountered cannot generate print record from the submit new request. see below errorFor production issues, please log a SR.
    ORA-00060: Deadlock detected. More info in file /u/oracle/PROD/db/tech_st/11.1.0/admin/PROD_tailindb/diag/rdbms/prod/PROD/trace/PROD_ora_4026.trc.
    ORA-00060: Deadlock detected. More info in file /u/oracle/PROD/db/tech_st/11.1.0/admin/PROD_tailindb/diag/rdbms/prod/PROD/trace/PROD_ora_4026.trc.
    ORA-00060: Deadlock detected. More info in file /u/oracle/PROD/db/tech_st/11.1.0/admin/PROD_tailindb/diag/rdbms/prod/PROD/trace/PROD_ora_4026.trc.Please see these docs.
    OERR: ORA 60 "deadlock detected while waiting for resource" [ID 18251.1]
    What to do with "ORA-60 Deadlock Detected" Errors [ID 62365.1]
    Thanks,
    Hussein

  • Unable to insert record in child block

    Dear all,
    I am facing a very strange problem.
    Actually i have a master-detail form where i need to insert master record as well as child records for the corresponding master item.
    For this i have a LOV in master block which populate the master item and execute the coresponding child records.
    so first time when i load the form i select a item from master block through a LOV this time :SYSTEM.BLOCK_STATUS is NEW and i populate a item from LOV then :SYSTEM.BLOCK_STATUS is NEW changed to query and i have inserted a next record in child block pressed F10 and it saved very well.
    But the problem is when i again select another item from master block through LOV and again tried to insert a record in child record this time it won't saved and the very stragly the cusor moved to master item showing the FRM-40600'Record has already been inserted'
    Please help why is it happening ?
    Need yours help.

    But the problem is when i again select another item from master block through LOV and again tried to insert a record in child record this time it won't saved and the very stragly the cusor moved to master item showing the FRM-40600'Record has already been inserted'When you select a new record in the Master block through the LOV, make sure you clear your form before you query the selected record. Forms thinks you are modifying the same master record and not a new record.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • 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

  • How to loop through records in a block

    How do I get the count of records in a data block after the EXECUTE_QUERY?
    If I want to manually insert or update records into the table from the datablock how do I loop thru' records in the block.?
    Also for 'WHERE' clause of update statement is there anyway to tie up the rowid to the current row in the form.

    Use get_block_property('block',QUERY_HITS).
    For the second question :
    Set the properties of block to be INSERT_ALLOWED=FALSE,UPDATE_ALLOWED=FALSE, next do:
    go_block('block');
    first_record;
    set a local handler of errors
    loop
    next_record;
    end loop;
    when others then
    catch the error "Record must be inserted first...'
    For the third question set the DML Returning Value = Yes in property palette of the block and access the rowid as
    declare
    rowid_ rowid;
    begin
    rowid_:=:block.rowid;
    end;
    HTH

  • How to get the total record in the block before save them

    Hello,
    I need to recalculate the amout for all records in one block before saving them.
    How can I get it?
    Thanks for your helping

    You write a loop, something like this:
    Go_block('B1');
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    First_Record;
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    Loop
      If :system.record_status in('CHANGED','INSERT') then
        -- modify the record here--
      End if;
      Exit when :System.Last_Record = 'TRUE';
      Next_Record;
    End Loop;
    First_Record;But be very careful-- If your block can fetch a large number of rows, (over 100), this loop can take a long time, and you should not use this method. The loop will continue fetching more rows from the database until all rows satisfying the query are retrieved.

  • How can i get no. of records in a block?

    How can i get no. of records in a block?
    please advise me................

    if you are looking for the number of records a block can display then use get_block_property -> RECORDS_DISPLAYED, if looking for the number of records the last query returned use get_block_property -> QUERY_HITS
    KK

  • User selection to return filtered record set

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

    Hi,
    I want to create a JSP which allows a user to enter search criteria for several columns of a table. I will use the entered values to set the sql where clause and produce the filtered record set. (eg the user enters a particular customer code and status code in order to see a list of orders placed by that customer which have the selected status code.)
    The problem I have is this: I want the input fields for the selection criteria to be combo boxes populated with values from the database.
    What is the best way to do this?

  • How to Save Multiple Records In Data Block

    Hi All,
    I Have Two Blocks --> Control Block,Database Block
    Please Any Idea How to Save Multiple Records In Data Block when User changed Data in Control Block.
    Thanks For Your Help
    Sa

    Now i have to use each record of control block(ctl_blk) as where condition in data base block(dat_blk)and display 10 records from database table.>
    Do you want this coordination to be automatic/synchronized or only when the user clicks a button or something else to signal the coordination? Your answer here will dicate which trigger to put your code in.
    As to the coordination part, as the user selects a record in the Control Block (CB), you will need to take the Key information and modify the Data Block's (DB) "DEFAULT_WHER E" block property. The logical place to put this code is the CB When-New-Record-Instance (WNRI) trigger. You code will look something like the following:
    /* Sample WNRI trigger */
    /* This sample assumes you do not have a default value in the BLOCK WHER E property */
    DECLARE
       v_tmp_dw    VARCHAR2(250);
    BEGIN
       v_tmp_dw := ' DB_Key_Column1 = '||:CONTROL.Key_Column1||' AND DB_Key_Column2 = '||:CONTROL.Key_Column_2;
       Set_Block_Property('DATA_BLOCK', DEFAULT_WHER E, v_tmp_df);
       /* If you want auto coordination to occur, do the following */
       Go_Block('DATA_BLOCK');
       Execute_Query;
       /* Now, return to the Control Block */
       Go_Block('CONTROL_BLOCK');
    END;
    The Control block items are assigned with values in Form level (Key_exeqry).If your CD is populated from a single table, it would be better to create a Master - Detail relationship (as Abdetu) describes.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Urgent: how to get filtered records in ALV

    Hi
    I have used ALV in OO context. However when i apply the filter and get the filtered entries on the screen, I want to get these filtered records into an internal table.  How do I do this.  I have tried using the methods GET_FILTERED_ENTRIES and GET_FILTER_CRITERIA, but it does not work.  Please help me in getting the filtered records into an internal table.
    Thanks
    Vijay

    You can use REUSE_ALV_GRID_LAYOUT_INFO_GET to get the information about the layout, including the filter criteria, then use that to figure out which records to process.

  • Enabling Insert allowed for particualr records in a block,

    Hi All,
    I have a requirement to enable insert allowed(and delete allowed) button for only particular records(say for all records where column1=2) and for all other values that insert allowed button should be disabled.
    I tried setting the property
    SET_BLOCK_PROPERTY for insert allowed for my block, in new_block_instance.
    when i'm querying the first time with column1=2, its working fine.
    But, when im querying my blcok with column1=5 and then requerying the block with column1=2, im facing issue. insert allowed button is disabled here.
    Not sure, whether this can be achieved or not using this way. Please suggest me if there is any other ways we can do in oracle forms.
    Thanks & regards,
    Pavan Kumar

    I have used the below code in when new record instance at block level,
    IF event='INSERT'
    THEN
    IF :xxscp_gbl_exp_detail_v.order_type=5
         THEN
         SET_BLOCK_PROPERTY('XXSCP_GBL_EXP_DETAIL_V',
         insert_allowed,
         property_true);
    ELSE
    SET_BLOCK_PROPERTY('XXSCP_GBL_EXP_DETAIL_V',
         insert_allowed,
         property_false);
    END IF;
    END IF;
    as i already told, it work when i directly search with order_type=5.
    But not working, when i first search with order_type=1 and then with order type 5.
    Thanks in advance,
    pavan

  • Multi-Record (NON-DB) block - duplicate records

    I have a non-db block called 'EDITOR_INFO' that captures all the editor's information. The block has the following fields in it: editor_name,editor_type,address_lines1 thru4, city, state, zip, taxid_ssn_type,taxid_ssn.
    I need to check to make sure that the user is not entering the duplicate editors. How can I adapt the infamous Kevin Clarke's solution to this (if at all)? What would be my datablock, control block etc?
    Can any one pls. provide any guidance.
    Thanks,
    Chiru
    Edited by: Megastar_Chiru on Nov 8, 2010 3:55 PM
    Edited by: Megastar_Chiru on Nov 8, 2010 3:56 PM

    Chiru, if all you need is to add/query records in a block, you should consider making a data-block instead of control-block. And use POST to post the data into table which will let you check against the table if a record exists or not.
    But if you want to have it done using a control-block then follow below sample steps.
    In WHEN-VALIDATE-RECORD of your control block, you can check if entered record is already in the table or not.
    If it exists, then raise error message and stop until user corrects the data... if it does not exist, then INSERT into the table.
    For this scenario, I created a small table with two columns.
    CREATE TABLE TABLE_A (Col1 NUMBER, Col2 VARCHAR2(30));Now I created a form with a control block (BLOCK2). It has 10 records with vertical layout and two control-items on it (TEXT_ITEM4 and TEXT_ITEM5). And below is code used on WHEN-VALIDATE-RECORD.
    -- WHEN-VALIDATE-RECORD
    DECLARE
      temp VARCHAR2(1);
      CURSOR c_check_existance IS
      SELECT 'X'
        FROM table_a
       WHERE col1 = :BLOCK2.text_item4;
    BEGIN
        :GLOBAL.Valid_Records := 'N';
         IF :block2.text_item4 IS NOT NULL THEN          
              OPEN c_check_existance;
              FETCH c_check_existance INTO temp;
              IF c_check_existance%FOUND THEN
                   CLOSE c_check_existance;
                                                    :GLOBAL.Valid_Records := 'N';
                   MESSAGE('Record already exists in table');
                   RAISE FORM_TRIGGER_FAILURE;
              ELSE
                   INSERT INTO table_a (col1, col2)
                                VALUES (:block2.text_item4, :block2.text_item5);
                                                    :GLOBAL.Valid_Records := 'Y';
              END IF;
              CLOSE c_check_existance;
         END IF;
    END;Remember, when making a control block like a data block, you have to code everything yourself.

  • Jump to one defined record in multirecord block

    Hello.
    I have a multirecord block.
    ex:
    rec, day, text
    rec1, day1, text1
    rec2, day1, text2
    rec3, day2, text1
    rec4, day2, text2
    rec5, day2, text3
    rec6, day3, text1
    User can select any record in that block. But when he presses one button, form should first jump to first record of that day, then execute everything else in that trigger.
    If the user is in record:
    rec5, day2, text3
    form should jump to record:
    rec3, day2, text1
    If the user is in record:
    rec2, day1, text2
    form should jump to record:
    rec1, day1, text1.
    And so on.
    Is there a way to do that?
    Thanks.

    Another technique ...
    Declare
         v_Day Table.Field%Type;
    Begin
         v_Day := :Rec.Day;
         Previous_Record;
         Loop
              if :Rec.Day <> v_Day then
                   Next_Record;
                   Exit;
              else
                   Previous_Record;
                   if :System.Cursor_Record = 1 then
                        Exit;
                   End if;
              End if;
         End Loop;
    End;
    Best regards
    R E H A N M I R Z A

Maybe you are looking for