Selecting values in Multi record block

Hi
Good Day !
Senario :
i have a block(age_file) which have colum A( DB item) , colum b (DB item) , colum X (non db item) with check box.. I have 1000000 records in it....
Block (age_file)
colum A( DB item) colum b (DB item)
abc 123
xyz 456
ert 852
The requirement is if i select the records using check box , the corresponding value in the column should concatenated and the value should present in colum X (non db item) , ie , if i select 1 & 3 record , the value in the colum X (non db item) should be abcert
Please help me in this asap.
Thanks in advance

Hai,
Try this code/
DECLARE
     Str_Result VARCHAR2(30000);
     Num_Total_Records NUMBER;
     Num_Loop_I NUMBER;
BEGIN
     Str_Result := '';
     GO_BLOCK('<detail_block_name>');
     FIRST_RECORD;
     LAST_RECORD;
     Num_Total_Records := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));
     FIRST_RECORD;
     FOR Num_Loop_I IN 1..Num_Total_Records LOOP
          IF :<detail_block_name>.<check_box> = 1 THEN
               Str_Result := Str_Result || '<delimiter>' || :<detail_block_name>.<first_column> || '<delimiter>' || :<detail_block_name>.<second_column>;
          END IF;
          NEXT_RECORD;
     END LOOP;
     FIRST_RECORD;
<your code to use the combined string>
END;Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks.

Similar Messages

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Updating a value of a text item in a multi record block based on a change

    Hi,
    I need to change the value of a text item in a multi record block based on a change to another item's value in the same block.
    Suppose there's a text item in a multi record block called dt1 which is of type date, which is changed in a particular record. I want to change the values of the another item in the same multi record block, for all other records by running a loop through all the records in multi record block. I dont want to do it on the press of a button, it should do automatically on change. Help me resolve this issue.

    Hi,
    I need to change the value of a text item in a multi record block based on a change to another item's value in the same block.
    Suppose there's a text item in a multi record block called dt1 which is of type date, which is changed in a particular record. I want to change the values of the another item in the same multi record block, for all other records by running a loop through all the records in multi record block. I dont want to do it on the press of a button, it should do automatically on change. Help me resolve this issue.

  • Get the first item value of previous record in a multi record block

    Hai,
    I have a multi record block with four items.I should get the first item value of the previous record so that I can increment its value in the current record.
    Thanks.........

    If you want a distinct value in each row or to be able to retrieve the records in the same order they were written then you should use a sequence.
    If you want to retrieve the records in the same order they were created in the block then you will need a diffferent solution to the one you outline here since a user could enter a new record between two others.
    I posted this a while back in response to someone who was using a sort_key item and resetting it for each row when a new record was inserted:
    If you make the sort_key bigger then you have much more room to insert new rows in between existing rows without having to reset all the sort_keys.
    Eg. you have rows with sort_keys of 129282000000000000 and 129283000000000000 (you can have more zeros if you want) and you want to insert a row in between. if you're using oracle forms then the user would have to click on the first of these rows and then do 'insert'. in your insert process you would store the sort keys of the current record and the one below, create a blank record in between and set the sort_key of that record to the average of the other two. you will be able to insert many new rows in between the original 2 before running out of space in the sort_key field.
    the method above is not sufficient, there are some other cases to consider:
    1) when the user is on the last record of the block then you will just create a new record with sort_key set to a greater number than the row before. you can have the sort_key defined as number(38) and to safely allow you to enter 1000 rows each new row would normally be 10E33 greater than the previous one.
    2) when the user is entering the first record then just set the sort_key to 10E33.
    3) on the off-chance that you do insert a great number of records and cannot insert another in between then you would need to alert the user, process the records so that the sort_keys are evenly spaced and requery the block. this processing could be scheduled nightly to make this eventuality even less likely.
    4) make sure the user cannot run the default 'clear_record' procedure. this would break my method as well as yours!
    James.

  • Deleting selected record in a multi-record block

    I am using Form 6i.
    I have two multi-record block viz. BLK_A and BLK_B.
    BLK_A has record displayed property set to 4
    BLK_B has record displayed property set to 8
    Each block has checkbox item.
    BLK_A contains records retrieved from table after entering data in selection criteria.
    When checked on anyone checkbox of BLK_A, then it displays related information in BLK_B.
    But when I uncheck the checkbox of BLK_A, then how to delete records in BLK_B.
    Thanks in advance.
    Regards,
    Vikas

    No, absolutely not.
    I cannot use this method.
    Because if two checkbox is check in BLK_A, then records related to both record in BLK_A will display in BLK_B. If I uncheck any one checkbox of BLK_A, then only records related to that checkbox should be deleted.
    If I use your suggestion, then all data will be removed.
    Thanks and regards,
    Vikas

  • Duplicate item value in a Multi-Record Block

    Is there a way to chek duplicate value entered in multi record block?
    I have seen some solutions in this forum however nothing has worked for me till now. (using the formula, creating hidden items & creating group etc)
    Thanks in advance,

    To see if there are any other records in the block with the same value, use Kevin Clark's famous function to trap duplicates. You can find Kevin's function write up here:
    Re: checking for same rows in a tabular
    From Kevin's post:
    Create a field PK_COPY in a control block.
    Create program unit function COMPARE to compare two input params returning 1 if they match else 0.
    Create a field in the datablock PK_MATCH, calculation property formula, formula COMPARE(:DATA_PK, :PK_COPY)
    Create a field in the control block NO_OF_MATCHES, calculation property summary, summary type SUM, summarised
    item PK_MATCH.
    Also, your control block requires the Single Record property set to yes, and the base table block requires the Query All Records property set to yes.
    WHEN-VALIDATE-ITEM on DATA_PK
    :CONTROL.PK_COPY := :DATA_PK;
    if :NO_OF_MATCHES > 1 then
      message('You have already used that one');
      Raise form_trigger_failure;
    end if;

  • Get next value in a Multi Record Block

    Hi,
    I've a Multi Record block with 2 items like below.
    pos width
    1 7
    8 5
    13 5
    18 2
    ie pos in next item is sum of pos and width of previous item.I've already implemented this.
    The problem is if the user changes width in a particular record,I want to change next records pos automatically.
    To achieve this,I wrote a when-new-record -instance-trigger as follws:
    if :system.cursor_record=1 then
    :pos:=1;
    elsif :system.record_status='changed' then
    :pos:=:pos+:width;
    end if;
    but even Though I change column width of block,:system.record_status still remain 'INSERT'.
    Pls can u pls tell me how can I acheive this?
    Prashanth Deshmukh

    You cannot use Record Status like that.
    You need to create a procedure that loops through your entire block, keeping track of the pos and width of the prior record to calculate the new pos of each record.
    Your procedure would need to do something like this:
    Declare
        v_Pos  pls_integer := 1;
    Begin
      Go_block('B1');
      First_Record;
      Loop
        Exit when :System.record_status='NEW';
        :B1.pos := v_Pos;
        v_Pos := v_Pos + :B1.width;
        Exit when :System.last_record = 'TRUE';
        Next_Record;
      End Loop;
      First_Record;
    End;

  • Query about multi record block

    Abdetu
    Please clarify this
    I have a multi record group on the canvas, which displays 5 records at a time. The block is based on a table. All the items, except 3 items are displayed items.Now in the block I have a list item, in which I have two values "PO" and "TSF".. If user selects PO, associated text items will get enabled and user will be entering the values .. Same is the case with TSF .. And at the end user selects Ok button to save the record to the database
    Now while fetching the records (based on query) ..once the records are fetched, control will be on PO/TSF list box, now the user can either change PO to TSF or TSF to PO ..or he/she may opt not to change also.. If user changes PO to TSF, only that particular record's TSF fields should get enabled .. The problem what I am facing is, when the control comes to PO/TSF list box.. since its multi record block, all the record's PO/TSF list box are getting enabled
    In the sense, if control is in the 1st record of multi record block, only those fields should get enabled, once the user navigates to the text item which is the last of that particular record, then 2nd record should get enabled....
    Can I know the solution
    Regards
    Message was edited by:
    Seshu
    Message was edited by:
    Seshu

    Hello Seshu
    ur case explanation should be in points 1,2,etc as possible leaving extra lines and spaces in between .. and the case should be more clear and summarized like:
    1- I have multi-records data block.
    2- I have a static list item with 2 values eg. (a and b).
    3- Depending on selecting from the list some items r enabled.etc.
    Kindly note that, this will facilitate ur problem to be more readable,recognizable and save time and effort of someone who wants to help u.
    Here comes the confusion:
    Now while fetching the records (based on query)
    The problem what I am facing is, when the control comes to PO/TSF list box.. >since its multi record block, all the record's PO/TSF list box are getting enabled i think with the piece of code i have just posted to u this can't be happened since it disable all the record's PO/TSF.
    if this didn't solve ur problem i suggest either u post ur code to help u or u try to put some validations with :
    if statment inside the loop depending on the list item's values which will enable or disable related items to the list.
    Hope this help u,
    If any Questions pls let me know..
    Regards,
    Abdetu..

  • Validate a Multi Record Block.

    Hello every body-
    Would appreciate your inputs as to how to go about doing this.
    I have a multi record block like below.
    SEQ # THEMES PICK
    1 THEME 1
    2 THEME 2
    3 THEME 3
    4 THEME 4
    5 THEME 5
    6 THEME 6
    The 'PICK' field is a check box, that the user will click on if he needs to select a particular 'THEME'.
    I need to do the following validations ( I will be having a button something like INSERT BUTTON) at the bottom of the multi column block.
    .. Only 3 THEMES are to selected.
    .. If more than 3 THEMES are selected, need to show an alert stating that only 3 THEMES can be selected, allow the user to change selections.
    .. If only 3 THEMES are selected, need to insert the selected THEMES into a table.
    For example, in the above sitation, if the user picks 'THEMES' with SEQ# 2,4,5; then I need to insert the SEQ #, along with the other primary key (which is STUDENT ID) into the table.
    Would really appreciate if any one could let me know how to do this.
    Thanks for your time..

    1) Make a hidden summarized number field called mycounter in the same block. Set the summarized function to sum, block to 'myblock', field to 'mycheckbox', calculation mode to "summary"
    2) Make the checked and unchecked values of the check box 1 = checked and 0 = unchecked. Set the datatype of the checkbox to a number.
    3) In the when-checkbox-changed of the checkbox put this code..
    if :my.mycounter >= 4 then
      message('Error:  May only check 3 or less.');
      :myblock.mycheckbox := 0;
    end if;With this code they wont be able to check more than three rows. This is one piece of your puzzle anyway.
    Message was edited by:
    Mark Reichman

  • How to do it in multi-record block

    Hi all,
    i have 1 text items in a multi-record block number of record displayed 10
    and i have values like 100 , 50, 30 in first 3 records and in 5th record i want to put some value like
    20 then i want to calculate all values like 100 + 50 + 30 +20 = 200 and i want to put the total value in a single record block.
    but my problem is i cannot able to calculate all the value because for the totale value i have to
    write a for loop to loop through the record
    but go_block() is not working in post_change .
    if any solution is there plz suggest.......

    Hi zeeshan
    my problem is i cannot able to calculate all the value because for the total value
    put the total value in a single record block.
    First pls the following...
    Guidelines for Working with Calculated Items Calculated items_
    1- They are display-only control items.
    2-Calculated items cannot be database items.
    3.While you can set a calculated item's Enabled, Mouse Navigate, and Keyboard Navigable properties to Yes,
    you cannot set the Insert Allowed or Update Allowed properties to Yes
    Second Keyword: TOTAL is a reserved oracle key word... pls read the Details...
    go_block() is not working in post_change .well u can use timers but no need for it u can reference block item but first u have to accumulate the values per record in WHEN-VALIDATE-ITEM TRIGGER in the last calculated item which is inserted by the user and assign it to the display item in ur current multi-record block :*block_name.total_item*.. as follow...
    :block_name.total_item := :item1 + .... ; Then u create a second display item > no of records property = 1 , named e.g. final_summarized_totals
    In order to summarize this total values accumulated in the multi-record display item named e.g. block_name.total_item
    Finally using PRE-INSERT , PRE-UPDATE,PRE-DELETE Triggers to assign the value calculated into the display item * block_name.total_item* into the db_item into the previously mentioned Trigger Block-Level Off-course.
    :block_name.total_db_tem := :i:block_name.final_summarized_totals ; Hope this helps...
    Regards,
    Amatu Allah

  • How can I create a loop in a multi-record block (on the background)

    I have a multi-record block.
    In one item I change a value.
    Upon this change, in the when-validate-item I would like to
    change other records in the same block.
    I planned to loop the block with go_record and to do my things
    in each record. Unfortunately the go_record built-in is
    restricted and cannot be used in a wvi-trigger.
    Another approach can be to update the records in the database
    and to perform an execute_query after this change. Also this
    procedure cannot be used in a wvi.
    How can I easily loop in a multi-record block???

    You can try to put loop with go_record in KEY-NEXT-ITEM on that
    field.
    Or if you change something and then press KEY-COMMIT you can
    update another records in database and after commit do again
    execute_query. Something like :
    on KEY-COMMIT:
    update_another_records;
    commit_form;
    execute_query;

  • How to call a report with a bind variable from a multi-record block

    Hi,
    I have created a report using the BI Publisher functionality. I did all the integration, created the SQL Query and uploaded the template. Up till here everythings fine!
    My SQL Query has 2 bind variables.
    I will call my report from a multi record block, at the end of each record an icon is shown which the user can click to open the report.
    I created a column link for this item (PRINT_REPORT=Inschrijvingsformulier) but I do not manage to pass the parameters to my report. The parameters I want to pass are 2 columns in this Multi Record block.
    I created 2 hidden fields on the page P9_PARAMETER1, P9_PARAMETER2 with the same names as my bind variables and fill this in with the values #PARAMETER1#, #PARAMETER2# from the multi record block.
    It seems it does not work as my report stays empty. (also XML file stays empty).
    Am I trying the wrong way?
    Thanks for any advice,
    Kris

    hi khadeer,
         create one report program and write the required code,and call this function module 'SSF_FUNCTION_MODULE_NAME' and give your smartform name  and also when u activate ur smart form u will get one function module call that function module also and specify any tables used...
    i think this solves ur problem...
    any queries revert back..
    pls reward points if helpful,
    shylaja

  • How to do validation on multi record block at run time...

    Dear Friends,
    I have to do validation at run time on multi record block.
    If user tries to enter and save two or more records in same multi record block with same data at run time, it should not allow it and display a message like, " error : Records are having same(duplicate) values. "
    I already did validation with the data coming from database table using cursor. But confused about how to do at run time(on one screen only) ??
    Please, give details about how to check duplicate records on form block before saving it to the table ????
    Regarding details would be greatly helpful.
    thanks,

    Hi...Pankaj
    thanx for your reply..
    I already did validation for the data coming from table....
    but I need to do it on form only...at run time...
    exa...
    In one multi record block
    record no : column 1 : column 2 : column 3
    1 abc 123 hi
    2 abc 123 hi
    so it should check on the form itself, here I m not getting data from table...I am just
    navigating from first record to second using down arrow.
    so, may be 2 possibilities.
    1) when user navigates using tab to third record, it should say like two duplicate records.(may be like when validate record or item)
    2) or when user tries to save, it should say two duplicate records.
    so, everyting should take place on form screen only.....
    waiting for your reply,
    thanx...

  • Problem in displaying records in multi record block

    Hi all,
    I have a problem in displaying records in a multi record block in a form.
    I have 1 control block and 1 data block(multi-record block).
    Control block has one item CUSTOMER-ID. Data block has many other items related to customer.
    when a value is entered in customer-id text item, all the relavant details should be displayed in the data block.
    but, the records are overlapping in the same line in the data block, actually they have to be displayed one record per one line.
    The code is,
    IF :CUST_BLOCK.CUST_ID IS NOT NULL THEN
    GO_BLOCK('XBSI_CONTRACT_PRICE_FACTORS');
    FOR C1 IN C
    LOOP
    :XBSI_CONTRACT_PRICE_FACTORS.CUST_ID:=c1.site_use_id;
    :XBSI_CONTRACT_PRICE_FACTORS.CAT_ID:=c1.ipc_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.MFG_ID:=c1.mfg_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.INVENTORY_ITEM_ID:=c1.inventory_item_id;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_BASIS:=c1.price_basis;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_FACTOR:=c1.price_factor;
    END LOOP;
    Please help me out..
    Thanks in advance!
    Suman

    Hi Suman
    IF :CUST_BLOCK.CUST_ID IS NOT NULL THEN
    GO_BLOCK('XBSI_CONTRACT_PRICE_FACTORS');
    first_record;
    FOR C1 IN C
    LOOP
    :XBSI_CONTRACT_PRICE_FACTORS.CUST_ID:=c1.site_use_id;
    :XBSI_CONTRACT_PRICE_FACTORS.CAT_ID:=c1.ipc_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.MFG_ID:=c1.mfg_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.INVENTORY_ITEM_ID:=c1.inventory_item_id;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_BASIS:=c1.price_basis;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_FACTOR:=c1.price_factor;
    next_record;
    END LOOP;
    Try this. you are trying to show all the records in same line. so its overlapping.
    Thankyou
    [email protected]

  • Check box in a multi record block

    I have a multi record block that has a check box. I need to be able to go to the first record on the block, go through each row and check to see if it's selected. I will then get all the rows that were selected and passed it as a parameter in a package.I have already declared a global variable in the package to get all the rows selected.
    Can anyone please help.

    Hi
    This is my solution for your problem. If I understand correctly as you have to post the selected records from form to journal entry (a server operation). What you need to do is in your Oracle Forms multi record block construct a loop which goes from first record to last record of your data block, capture the selected records (wherever the check box is CHECKED ON) into a PL/SQL table structure (PL/SQL table is quite simillar to Oracle Forms RECORD GROUP structure, but more versatile as it can be recognized on the back end too).
    Once you populate the PL/SQL table with the selected record, pass the PL/SQL table itself as parameter to your package.
    Open the PL/SQL table in your destination code and do further processing with those selected records !!
    Hope this will work !!
    MOHAMMED R.QURASHI
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kay:
    I CANNOT USE A RECORD GROUP. I HAVE TO EVENTUALLY POST THE SELECTED ROWS INTO JOURNAL ENTRIES. I STILL NEED TO BE ABLE TO
    GET ALL THE ROWS SELECTED BY THE USER.CAN I USE A CURSOR IN THE FORM TO GET ALL THE ROWS
    SELECTED?.
    THANKS FOR THE REPLY GANESAN.<HR></BLOCKQUOTE>
    null

Maybe you are looking for