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;

Similar Messages

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

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

  • How to get the original record Number in Multi-Record Block

    Hello Everyone,
    I know how to find the duplicate item in the multi-Record block,
    For Ex:
    Line_Num            Item_Name             Quantity
    1                           AA                      10
    2                           BB                      20
    3                           AA Here 3rd record Item_name is duplicated, I can able to check and display the message that 'Item is duplicated' ,I found from [sheikyerbouti.developpez.com/duplicates/duplicates.htm] .
    but I want to show along with original line number i.e 1 when the item_name is entered .
    Here I want to check the original Line_Num and want to display the message
    'Item is duplicated,Update quantity in Original Line 1'
    Can anyone help me to get this?
    Thank You.
    Regards,
    Guru.

    Hi Francois,
    Actually I want to check and show the message when the item_name is entered i.e WHEN-VALIDATE-ITEM TRIGGER.
    I put the following code in WHEN-VALIDATE-ITEM TRIGGER
    Declare
         curnum number;
         dupnum number;
         cur_item varchar2(100);
         v_alert_no number;
         p_linerec varchar2(100);
    Begin
    curnum := TO_NUMBER(:System.Trigger_Record);
    cur_item := :Lines.Item_number;
    First_Record;
    p_linerec := :Lines.Item_number;
    LOOP
    If p_linerec = cur_item then
         dupnum := :Lines.Line_num;
         set_alert_property('ALERT_STOP',ALERT_MESSAGE_TEXT,
    'Duplicate Item Found,Update QTY in Original line number '||dupnum);
       V_ALERT_NO := show_alert('ALERT_STOP');
       :LINES.ITEM_NUMBER := NULL;
    :LINES.ITEM_DESCRIPTION:= NULL;
    :LINES.ITEM_REVISION:= NULL;
    :LINES.ITEM_CATEGORY:= NULL;
    elsIF (:System.Last_Record = 'TRUE') THEN
         Go_Record(curnum);
         EXIT;
      ELSE
         Next_Record;
      END IF;
    END LOOP;
    End; But I am getting the following error,
    FRM-40737:Illegal Restricted Procedure
    FIRST_RECORD in WHEN-VALIDATE-TRIGGERand then
    its showing for first line itself.
    Duplicate Item found.Update QTY in Original line number 1so I put the condition
    If :Lines.Line_num > 1 then --Only to check when the block having more than one record.but now it checking from second record and displaying,
    Duplicate Item found.Update QTY in Original line number 2 --(instead of Update QTY in Original line number 1)Can you tell me how can I change the above code for my requirement?
    Thank you.
    Edited by: Gurujothi on 27 Mar, 2013 5:20 PM

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

  • Setting background color in multi record block

    Hi all!
    I've a table with around 150 records of colors with html-color-names and rgb codes.
    I would like to have a sample item in my form 9.0.4 to display the color as a preview for
    each record in a multi-record block when querying the table.
    I would not like to create a visual attribute for each color. So display_item() is no choice.
    (except: somebody show me how to create va's with the japi)
    Somebody knows a way to accomplish this?
    Thanks in advance and regards
    Stauder

    Here's a solution which should work :
    1. Use a mirror item for the numeric item which has to
    be displayed
    using the format mask based on value in column1
    The data type of the mirror item : Char
    X and Y co-ordinates : Same as the item
    on which it is
    mirrored
    Size and Height : Same as the item
    on which it is
    mirrored
    2. On normal display, Mirror item is displayed
    3. When Mouse-Click or Pre-Text Item trigger on the
    Mirror Item :
    - Use the Go_Item ('Actual Numeric Item');
    This will bring up the Numeric Item and the Mirror
    item goes in hiding
    - A VWI trigger on Numeric Item should Then be :
    If ( :col1 = 'A' ) Then
    :Mirror_Item :=
    To_char(:NumericItem, ',999,999.99');
    Else
    :Mirror_Item :=
    To_char(:NumericItem, '99999999');
    End If;
    4. A key-Next-Item (On Numeric Item) or other trigger ??
    should then
    use Go_Item (:Mirror Item) to bring forward the
    formatted numeric item
    -- Shailender Mehta --

  • Check duplicate data entry in multi record block,which is a mandatory field

    Dear all,
    I have a situation where i have to check duplicate data entry(on a particular field,which is a mandatory field,i.e. it cannot be skipped by user without entering value) while data key-in in a Multi Record block.
    As for reference I have used a logic,such as
    1>In a When-Validate-Record trigger of that block I am assigning the value of that current item in Table type variable(collection type)
    as this trigger fire every time as soon as i leave that record,so its assigning the value of that current time.And this process continues
    then
    2>In a When-Validate-Item trigger of that corresponding item(i.e. the trigger is at item level) has been written,where it compares the value of that current item and the value stored in Table type variable(collection type) of When-Validate-Record trigger.If the current item value is matched with any value stored in Table type variable I am showing a message of ('Duplicate Record') following by raise_form_trigger failure
    This code is working fine for checking duplicate value of that multi record field
    The problem is that,if user enter the value in that field,and then goes to next field,enter value to that field and then press 'Enter Query 'icon,the bolth Validate trigger fires.As result first when-validate record fires,which stores that value,and then when-validate-item fires,as a result it shows duplicate record message
    Please give me a meaningful logic or code for solving this problem
    Any other logic to solve this problem is also welcome

    @Ammad Ahmed
    first of all thanks .your logic worked,but still i have some little bit of problem,
    now the requirement is a master detail form where both master and detail is multirecord ,where detail cannot have duplicate record,
    such as..........
    MASTER:--
    A code
    A1
    A2
    DETAIL:--
    D code
    d1
    d2 <-valid as for master A1 , detail d1 ,d2 are not duplicate
    d2 <--invalid as as for master A1 , detail d2 ,d2 are duplicate
    validation rule:  A Code –D Code combination is unique. The system will stop users from entering duplicate D Code for a A Code. Appropriate error message will be displayed.*
    actually i am facing a typical problem,the same logic i have been applied in detail section ,its working fine when i am inserting new records.problem starts when i query,after query in ' a ' field say 2 records (i.e. which has been earlier saved) has been pasted,now if i insert a new record with the value exactly same with the already present value in the screen(i.e. value populated after query) its not showing duplicate.................could u tell me the reason?and help me out...............its urgent plzzzzzzzzz
    Edited by: sushovan on Nov 22, 2010 4:34 AM
    Edited by: sushovan on Nov 22, 2010 4:36 AM
    Edited by: sushovan on Nov 22, 2010 8:58 AM

  • Check Duplicate data during data key-in Multi Record Block

    Dear all,
    I have a situation where i have to check duplicate data entry(on a particular field,which is a mandatory field,i.e. it cannot be skipped by user without entering value) while data key-in in a Multi Record block.
    As for reference I have used a logic,such as
    1>In a When-Validate-Record trigger of that block I am assigning the value of that current item in Table type variable(collection type)
    as this trigger fire every time as soon as i leave that record,so its assigning the value of that current time.And this process continues
    then
    2>In a When-Validate-Item trigger of that corresponding item(i.e. the trigger is at item level) has been written,where it compares the value of that current item and the value stored in Table type variable(collection type) of When-Validate-Record trigger.If the current item value is matched with any value stored in Table type variable I am showing a message of ('Duplicate Record') following by raise_form_trigger failure
    This code is working fine for checking duplicate value of that multi record field
    The problem here is that suppose if usee gets a message of ('Duplicate Record') and after that without saving the values if user try to query of that block then also when validate item fired where as I am expecting ORACLE default alert message('Do You want to save?'),I want to restrict this When-Validate Item fire during query time..........................while user try to query.
    Please give me a meaningful logic or code for solving this problem
    Any other logic to solve this problem is also welcome

    When-Validate-Record trigger
    When-Validate-Item triggerThat smells like Oracle Forms...
    And the Oracle Forms forum is over here: Forms

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

  • Another multi-record block question

    I have always struggled with this. I have a muti-record block(10 records displayed). Eventhough my block is a db block, I have not assigned it a table. Hence, it is a non-db block. If I set enabled on a txt box, it
    is enabling the entire column. I need to enable only the text box on which the cursor is/user navigated to.
    How to do it?
    Thanks,
    Chiru
    Edited by: Megastar_Chiru on Sep 21, 2010 2:03 PM

    ok..here is the explanation of the issue
    in my multi-record block, there is a drop down list column with 2 values "Monthly %" and "Half-Rent". So, for example, in record 1, the drop-down could be chosen as "Monthly %" while in rec2, it could be "Half-rent". Right next to this list column, I have a text box. When the user chooses "Monthly %", the text box need to be enabled to allow keying a % value (say 5%). While in rec2, since the user chooses "Half-rent", the text box needs to be disabled for this record. How to accomplish this?
    Thanks,
    Chiru

  • Disabling radio buttons in multi record block

    Need to be able to disable/enable one or more radio buttons in a group dynamically in multiple record block. Tried setting enabled properties but it sets for all records in the block. At the very least, I need to reset an item using radio to previous value if setting is invalid but when-radio-changed has already set value. Thank you.

    Your one row record has 5 items, then I assume empno, ename, ssn, phone, deptno 5 items on your multi-record block.
    you entered first row record as,
    empno, ename, ssn, phone, deptno
    100 John Smith 123-45-9999 234-333-9999 2
    101 Al Brown 222-34-1111 123-456-7890 2(duplicated)
    You want your code to duplicate the second deptno record as 2 instead of typing in, right?
    If so, then you add KEY-NEXT-ITEM trigger on item :phone, inside put,
    go_item('deptno');
    duplicate_item;
    It will copy the first deptno record 2 for the second record as showed above.

Maybe you are looking for

  • TS2580 i have problem to republish my site

    Hi I have trying to republish my site using iweb ftp server but it does not working longer!? Help me please! Mizu

  • Possible fonctionalities with SAP MM

    Hello Could you confirm that with SAP MM I can deal with automatic creation of purchase orders from a flat file (with Idocs or BAPI solutions) and that the creation of the purchase order can generate an EDI message to send the order to the supplier ?

  • Attachments opening twice

    Just noticed this today... when I open attachments from Mail now, it opens them twice automatically. Didn't do this before the latest Java Security update.

  • NXT files (once deleted how to recover?)

    Hi, I am using the brick from LEGO Mindstorms NXT 2.0 I accidentally deleted the file RedData.dat from my NXT, and I need that for one of my programs. Even when I tell the program to "write to red data file", it does not recreate the file, so I'm lef

  • How can i recover deleted text messages?

    How can I recover deleted text messagres?