Keep Previous Value of Cell

Hi there,
I have two columns, let's call them Event Date (Column A) and Previous Event Date (Column B).
I would like to implement some <acronym title="visual basic for applications">VBA</acronym> code (or use formulas if necessary) that automatically keeps the previous value of Event Date and retains it in the adjacent cell for Previous
Event Date.
For example, if A3 = Jan-03 and I update A3 to Jan-04, B3 would then show Jan-03 as it is the previous value of the cell.
I would like this code to work for a whole column of cells, not just a single cell.
I'm open to any & all ideas and appreciate the help. If any clarifications are necessary, just let me know.

Right-click the sheet tab.
Select View Code from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newVal As Variant
' Code won't work if multiple cells have been changed
If Target.Count > 1 Then
Exit Sub
End If
' Only act if cell in column A has been changed
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
' Turn off events and screen updating
Application.EnableEvents = False
Application.ScreenUpdating = False
' Get new value
newVal = Target.Value
' Undo to restore old value
Application.Undo
' Copy old value to adjacent cell
Target.Offset(0, 1).Value = Target.Value
' Redo the change
Target.Value = newVal
' Turn on screen updating and events
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Remarks:
If you change multiple cells at once, the code won't do anything.
When you change a cell in column A, that cell will remain the active cell, i.e. Tab or Enter won't activate another cell.
When you change a cell in column A, Undo will be disabled.
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • Keep previous values for Select-Options

    I am using macros to populate my selections with the previously entered values.  Everything works fine until I want to delete the previous selections for so_snp via the Trash Can button.  The selections come back.  The issue seems to be that the selections are deleted from the so_snp range but then the AT SELECTION-SCREEN OUTPUT executes makro_get_range which re-populates the so_snp selection from the data stored in the buffer because so_snp is initial.  How do I get the AT SELECTION-SCREEN code to execute first so that the makro_set_range can clear out the shared buffer for '/SAPAPO/PT_PLAN_SNP'.  I have included excerpts from my ABAP program.
    Any help would be appreciated.  I struggled with this all day long.
    Best regards,
    Sandy
    DEFINE makro_get_range.
    initialization
      clear:
        lv_line,
        lv_key.
    import SET/GET-parameter from shared buffer
      if &2[] is initial.
        concatenate sy-uname  &1 '_T' into lv_key.          
        import &2[] from shared buffer indx(st) id lv_key.
        if sy-subrc eq 0.
          read table &2 index 1.
        endif.
      endif.
      if &2 is initial.
        get parameter id &1 field &2.
        if sy-subrc ne 0 and &2 is initial.
          refresh &2[].
        endif.
        if not &2   is initial
           and &2[] is initial.
          append &2.
        endif.
      endif.
    END-OF-DEFINITION.
    DEFINE makro_set_range.
    initialization
      clear:
        lv_line,
        lv_key.
      concatenate sy-uname &1 '_T' into lv_key.
    export SET/GET-parameter to shared buffer
      describe table &2[] lines lv_line.
      if lv_line gt 1.
        export &2[] to shared buffer indx(st) id lv_key.
      else.
        delete from shared buffer indx(st) id lv_key.
        set parameter id &1 field &2.
      endif.
    END-OF-DEFINITION.
    SELECT-OPTIONS so_snp FOR /sapapo/matloc-planner_snp.
    AT SELECTION-SCREEN OUTPUT.
       makro_get_range '/SAPAPO/PT_PLAN_SNP'    so_snp.
    AT SELECTION-SCREEN.
        makro_set_range '/SAPAPO/PT_PLAN_SNP'    so_snp.

    Can you set a flag to indicate that it needs to be done only once like below?
    AT SELECTION-SCREEN OUTPUT.
    IF v_flag_get_done_once IS INITIAL.
    *-- get the values from the shared buffer
      makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.
      v_flag_get_done_once = 'X'.
    ELSE.
    *-- user manipulated the selection screen values, so
    *   don't do it again. Do Nothing.
    ENDIF.
    Srinivas

  • How to delete formula from cells and keep the values in Excel VBA

    Hi,
    In my Excel I have 15 columns. In column F which has a formula (INDEX MATCH), it has contains "RECEIVED" and "INTRANSIT". I need to filter the column F for all "RECEIVED" and then remove the formula from cells and
    retain or keep the values that are already in the cells. something tricky and i'm not sure on how to work on this in Excel VBA.
    Below is my initla VBA code:
    I already have the codes on how to filter. kindly please help me on how to do this. thank you in advance.
    Sub test_Click()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim rng As Range
    Dim lrow As Long
    Set wb = ThisWorkbook
    Set ws = wb.Sheets("Intransit_")
    Application.ScreenUpdating = False
    ws.AutoFilterMode = False
    With ws
    lrow = .Range("F" & Rows.Count).End(xlUp).Row
    Set rng = .Range("A1:R" & lrow)
    Debug.Print rng.Address
    rng.AutoFilter Field:=6, Criteria1:="RECEIVED"
    End With
    Application.creenUpdting = True
    End Sub

    Solved.
    Sub test_Click()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim rng As Range
    Dim lrow As Long
    Dim rRec As Range
    Dim btField As Byte
    Set wb = ThisWorkbook
    Set ws = wb.Sheets("Intransit_")
    btField = 6
    Application.ScreenUpdating = False
    ws.AutoFilterMode = False
    With ws
    lrow = .Range("F" & Rows.Count).End(xlUp).Row
    Set rng = .Range("A1:R" & lrow)
    With rng
    .AutoFilter Field:=btField, Criteria1:="RECEIVED"
    On Error Resume Next
    Set rRec = .SpecialCells(xlCellTypeVisible)
    On Error GoTo 0
    End With
    .AutoFilterMode = False
    If Not rRec Is Nothing Then
    With rRec
    .Columns(btField).Value = .Columns(6).Value
    End With
    End If
    End With
    Application.ScreenUpdating = True
    End Sub

  • Newbie: How can I store a previous value??

    I am trying to figure out how to do the following:
    int xcoor=0, ycoor=0, hstep, vstep;
    while true do
    update_step(hstep, vstep); // essentially have a big while loop to generate the necessary hstep/vsteps
    xcoor = xcoor + hstep; // I need to add a new hstep to the xcoor
    ycoor = ycoor + vstep; // I need to add a new vstep to the ycoor
    updategraph(xcoor, ycoor); // and feed the updated xcoor/ycoor to an XYgraph
    I think I should use a Master/Slave design? but how do I keep the previous value the first time in the Slave and then add the new values to the stored value??
    Attachments:
    new_Block_Diagram.bmp ‏2137 KB
    new_Block_Diagram.jpg ‏174 KB

    You probably want to use a shift register.
    Right-click on the right edge of the loop. Select the "Add Shift Register" option.
    It will add a widget on both the right and left sides of the loop.
    An item wired to the right side will appear on the left side during the next pass through the loop. You can initialize the value by wiring an input to the left side widget.
    [email protected]

  • Compare the current value with the previous value in the same column

    Hi all,
    I have to include a statement in a query which allows to compare the current value of column A with the previous value of column A (same column). from there, I need to add a condition in order to have the expected result.
    Let's take an example to illustrate what I want to achieve:
    I have the following columns in table called 'Charges':
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 50
    SID1111 9999 MD5553 50
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 80
    SID2222 8887 MD6662 80
    SID3333 6666 MD7771 90
    I want to check if the ship_id of row 2,3 (and more if available) is equal to the ship_id of row 1.
    If it is the case, then value 'together with the first batch_nr' in row 2 and 3 under Price column. If not, then keep the original value of Price column
    PLease see below the expected result:
    Ship_id batch_nr Order_nr Price
    SID1111 9997 MD5551 50
    SID1111 9998 MD5552 together with 9997
    SID1111 9999 MD5553 together with 9997
    SID2222 8887 MD6661 80
    SID2222 8887 MD6662 together with 8887
    SID2222 8887 MD6663 together with 8887
    SID3333 6666 MD7771 90
    Thanks in advance for your help, it is really urgent.
    Imco20030

    Hi,
    user11961002 wrote:
    Hi,
    Here is the query that I use:
    [ select
    sl.ship_id,
    o.ordnum,
    o.reffld_5 "BatchNR",
    sum(tc1.chrg_amt) "FreightPRC",
    sum(tc2.chrg_amt) "FuelPRC",
    sum (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt) "Total Price"
    from ord_line ol
    join ord o on (ol.ordnum = o.ordnum and ol.client_id = o.client_id)
    join shipment_line sl on (ol.ordnum = sl.ordnum and ol.client_id = sl.client_id and ol.ordlin = sl.ordlin)
    join adrmst a2 on (o.rt_adr_id = a2.adr_id)
    left join tm_chrg tc1 on (tc1.chargetype = 'FREIGHT' and tc1.chrg_role = 'PRICE' and tc1.ship_id = sl.ship_id)
    left join tm_chrg tc2 on (tc2.chargetype = 'FUELSURCHARGE'and tc2.chrg_role = 'PRICE' and tc2.ship_id = sl.ship_id)
    where sl.ship_id = 'SID0132408'
    group by o.client_id, o.ordnum, o.reffld_2, sl.ship_id, a2.adrnam, a2.adrln1, a2.adrpsz, a2.adrcty, a2.ctry_name,
    o.reffld_5, ol.early_shpdte
    order by ship_id
    ]That looks like the query you were using before you started this thread.
    Modify it, using the analytic fucntions FIRST_VALUE and LAG, like I showed you.
    I see that you did simplify the problem quite a bit, and it's good that you did that.
    It doesn't matter that your real problem involves joins or GROUP BY. Analytic functions are calculated on the results after all joins and GROUPS BYs are done. Just substitute your real expressions for the simplified ones.
    For example, in your simplified problem, there was a column called order_nr, but I see now that's it's really called o.ordnum. Where the solution I posted earlier says "ORDER BY order_nr", you should say "ORDER BY o.ordnum".
    Here's a less obvious example: in your simplifed problem, there was a column called price, but I see now that it's really SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt). Where the solution I posted earlier says "TO_CHAR (price)", you should say "TO_CHAR (SUM (tc1.chrg_amt + tc2.chrg_amt + tc3.chrg_amt))". (You can't use an alias, like "Total Price", in the same SELECT clasue where it is defined.)
    I removed some columns from the select as they are not relevant for the wanted action like 'adress details or other references'.
    Now here is the result:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 120
    SID0132408     MDK-000014-05602652     04641363     110     10 120
    as you can see, the 3 orders have the same shipment ID.
    The expected result should be shown under column 'Total Price' as follows:
    Shipment ID     Order Number     WMS Batch     Freight      Fuel Price Order Total Price
    SID0132408     MDK-000014-05602649     04641401     110     10 120
    SID0132408     MDK-000014-05602651     04641402     110     10 tog with 04641401
    SID0132408     MDK-000014-05602652     04641363     110     10 tog with 04641401Okay, so those are the correct results that I asked for, plus the incorrect results you're getting now. Thanks; extra information doesn't hurt.
    But where is the raw data that you're starting with?
    It looks like you tried to format the code (but not the results) by typing this 1 character:
    before the formatted section and this different character
    after the formatted section. To post formatted text on this site, type these 6 characters
    before the formatted section, and the exact same 6 characters again after the formatted section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Keep selectonechoice value

    Hi,
    I'm facing a problem with SelectOneChoice wich is configured as a dynamic list. Base data source is variable, List data source is View object, and labeled item is included. When I go to another page, and after that return, value of SelectOneChoice is blank item. How can I avoid selectonechoice from reseting and keep previously selected item in list?
    Thanks in advance
    Dragana

    Hi Dragna,
         When you go to the other page or when the value is selected you can record the currently selected value from the selectOneChoice object in a sesssionBean or by some other means.
         If you want to store it on a session bean.
         Create a session bean.
         Create a a managed property on the session bean.
         When you navigate to the new page or when the value is set record the selected value on property you created on the session bean.
         FacesContext ctx = FacesContext.getCurrentInstance();
         MySessionBean mySessionBean =(MySessionBean)JSFUtils.getManagedBeanValue(ctx, "mySessionBean");
         mySessionBean.setSelectedValue(selectOneChoice1.getValue);
         There is a method on backing bean which should look like this.
         public void setSelectOneChoice1(CoreSelectOneChoice selectOneChoice1) {       
    this.selectOneChoice1 = selectOneChoice1;
         Add code similar to below
         public void setSelectOneChoice1(CoreSelectOneChoice selectOneChoice1) {       
    this.selectOneChoice1 = selectOneChoice1;
         FacesContext ctx = FacesContext.getCurrentInstance();
         MySessionBean mySessionBean =(MySessionBean)JSFUtils.getManagedBeanValue(ctx, "mySessionBean");
         selectOneChoice1.setValue(mySessionBean.getSelectedValue());
         Now the value will be set when the page is painted unless something updates or happens to the data that populates the list.
         If you are concerned about the list being updated and the value no longer being present in the list or the order changed etc. You should record the value you are interested from
         the list that populates the selectOneChoice select items and set the selectOneChoice value to its position in the list when the user returns to the page.
         You can retrieve the results on bindings as follows.
         OperationBinding myBinding = bindings.getOperationBinding("myBinding");
         List l = ((List)myBinding.getResult()).get(0);
         int i = 0;
         boolean notFound = true;
         MyObject myObject= null;
         while (i < l.size() && notFound){
              myObject = (MyObject) l.get(i);
              if (myObject.mySelectItem = selectItem){
                   notFound = false;
         this.selectOneChoice1.setValue(new Integer(i));
         Kind regards,
              Richie.

  • Coloring JTable rows depending on the actual and previous value

    I need to change the background of the entire row of a JTable, but with the condintion of checking the value (Integer) in the column 0 of each row.
    I the actual value is equal to previous value I keep the same color (any color) if it is different I must change the color (to any other color).
    Any ideas how I could do that? I suppose I cant use CellRenderer because the Table is already full, so I was thinking about making a looping thru the table and chaning the background colors, but I have no idea how to do that.
    So far I have this code:
    int totalRows = modProdutos.getRowCount();
    int totalCols = modProdutos.getColumnCount();
    System.out.println("Total rows: " + totalRows);
    TableColumnModel tcm = tbProdutos.getColumnModel();
    DefaultTableModel modelo = (DefaultTableModel) tbProdutos.getModel();
    if (totalRows > 0) {
        int numeroOSAntes = (Integer) tbProdutos.getValueAt(0, 0);
        for (int i = 0; i < totalRows; i++) {
            int numeroOS = (Integer) tbProdutos.getValueAt(i, 0);
            if (numeroOS == numeroOSAntes) {
                // Paint the background with the same color (any color)
                System.out.println("Same Color: " + numeroOSAntes + " - " + numeroOS);
            } else {
                // Paint the background with a different color (any other color)
                System.out.println("Different color: " + numeroOSAntes + " - " + numeroOS);
            // keep the previous control number
            numeroOSAntes = numeroOS;
    }

            jTable1 = new JTable(0,4){
                @Override
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
                    Component c = super.prepareRenderer(renderer, row, column);
                    c.setBackground(Color.YELLOW);
                    boolean yellow = true;
                    for (int i = 1; i <= row; i++) {
                        if(!getValueAt(i,0).toString().equals(getValueAt(i-1,0).toString())){
                            yellow = !yellow;
                    if(!yellow){
                        c.setBackground(Color.WHITE);
                    return c;
            model = (DefaultTableModel)jTable1.getModel();
            model.addTableModelListener(new TableModelListener() {
                public void tableChanged(TableModelEvent e) {
                    jTable1.repaint();
            });

  • How to get a summ of all previous values

    Hello ALL,
    Could you please give an advice on how to find the sums of all previous values in 1 select without using dynamic sql. Cross join is not a variant because of a huge response time.
    OR may be there are any other ideas on how to find first rows with total sum equals to some general value? My idea is to find a sum of all preceding values and the first of such sums that would be equal to the general value or greater it is a necessary result.
    For example we have goods receipts:
    MATERIAL | BATCH | QTY
    material1 batch1 1
    material1 batch2 2
    material1 batch3 3
    material1 batch4 4
    material1 batch5 5
    material1 batch6 6
    and general qty is 7 - it's our current stock. So I should take material from [batch1 to batch4] to get necessary QTY >=7 (1+2+3+4=10>7) So our current stock consists of batch1,batch2,batch3 and remains of batch4.
    Thanks in advance!
    Edited by: user9321926 on Jun 18, 2010 3:56 AM

    Some thing like:
      1  select
      2     empno,
      3     sal,
      4     (select sum(sal) from emp b where  b.empno <= a.empno) running_total
      5* from (select * from emp order by empno) a
    SQL> /
         EMPNO        SAL RUNNING_TOTAL
          7369        800           800
          7499       1600          2400
          7521       1250          3650
          7566       2975          6625
          7654       1250          7875
          7698       2850         10725
          7782       2450         13175
          7788       3000         16175
          7839       5000         21175
          7844       1500         22675
          7876       1100         23775
         EMPNO        SAL RUNNING_TOTAL
          7900        950         24725
          7902       3000         27725
          7934       1300         29025
    14 rows selected.
    SQL>

  • Create a new column in a table that compares the value of one column with its previous value

    The DDL:
    DECLARE
    @T TABLE
    IDNO
    int,
    name
    varchar(40),
    [Date]
    datetime2,
    Price1
    float,
    Price2
    float
    DECLARE
    @K TABLE
    IDNO
    int,
    name
    varchar(40),
    [Date]
    datetime2,
    Price1
    float,
    Price2
    float
    INSERT
    INTO @T
    VALUES(22,'C_V_Harris','2014-01-02 10:23:49.0000000',
    23.335,      
    23.347)
    INSERT
    INTO @T
    VALUES(21,'C_V_Harris','2014-01-02 10:05:13.0000000',
    23.357,      
    23.369)
    INSERT
    INTO @T
    VALUES(20,'C_V_Harris','2014-01-02 09:56:15.0000000',
    23.364,      
    23.377)
    INSERT
    INTO @T
    VALUES(19,'C_V_Harris','2014-01-02 09:45:26.0000000',
    23.351,      
    23.367)
    INSERT
    INTO @T
    VALUES(18,'C_V_Harris','2014-01-02 09:43:20.0000000',
    23.380,      
    23.396)
    INSERT
    INTO @T
    VALUES(17,'C_V_Harris','2014-01-02 09:34:28.0000000',
    23.455,      
    23.468)
    INSERT
    INTO @T
    VALUES(16,'C_V_Harris','2014-01-02 09:30:37.0000000',
    23.474,      
    23.486)
    INSERT
    INTO @T
    VALUES(15,'C_V_Harris','2014-01-02 09:18:12.0000000',
    23.419,      
    23.431)
    INSERT
    INTO @T
    VALUES(14,'C_V_Harris','2014-01-02 09:16:06.0000000',
    23.360,      
    23.374)
    INSERT
    INTO @K
    SELECT
    ROW_NUMBER()
    OVER (ORDER
    by IDNO)
    AS RN,*
    FROM
    @T
    SELECT
    * FROM
    @K
    --not working:
    SELECT
    a.RN,a.Price2
    FROM
    @K a
    INNER
    JOIN @K
    b
    ON
    a.RN=b.RN-1
    WHERE
    a.Price2>b.Price2
    I need to create  a view with a column (say 'Comp' below) that compares the value of each row in Price2 with the previous Price2 row, and it is greater then +1, the
    same 0, and less -1.
    The processed table should be:
    IDNO
    name
    Date
    Price1
    Price2
    Comp
    22
    C_V_Harris
    1/2/2014 10:23:49
    23.335
    23.347
    0
    21
    C_V_Harris
    1/2/2014 10:05:13
    23.357
    23.369
    1
    20
    C_V_Harris
    1/2/2014 9:56:15
    23.364
    23.377
    1
    19
    C_V_Harris
    1/2/2014 9:45:26
    23.351
    23.367
    -1
    18
    C_V_Harris
    1/2/2014 9:43:20
    23.38
    23.396
    1
    17
    C_V_Harris
    1/2/2014 9:34:28
    23.455
    23.468
    1
    16
    C_V_Harris
    1/2/2014 9:30:37
    23.474
    23.486
    1
    15
    C_V_Harris
    1/2/2014 9:18:12
    23.419
    23.431
    -1
    14
    C_V_Harris
    1/2/2014 9:16:06
    23.36
    23.374
    -1
     How can I structure the statement to get (the most recent - order by date ) result for Comp?

    Satheesh Variath, I just had to make some corrections from your script to get the correct answer:
    CREATE
    VIEW vw_Comp
    AS
    SELECT
    TOP 1 t.IDNO,t.name,t.[Date],t.Price1,t.Price2,
    CASE
    WHEN t.Price2
    > LAG(Price2,1)
    OVER (PARTITION
    BY name
    ORDER BY IDNO) 
    THEN 1
    WHEN t.Price2
    < LAG(Price2,1)
    OVER (PARTITION
    BY name
    ORDER BY IDNo) 
    THEN -1
    ELSE 0
    END
    AS Comp
    FROM 
    @T t
    ORDER
    BY DATE
    DESC
    The adjustments: the selection of the most recent comparison (Top 1) and the use of the function LAG (instead of LEAD) to get the previous value of the column.

  • Previous Values of Selected Items in a Datagrid

    I have a datagrid which the dataprovider is bound to an ArrayCollection of Value Objects from a web service.
    One other thing which is important to point out.   The Value Objects are created automatically for the Data/Service and so if I change the files, they will just be overwritten the next time I make a change to the service.
    The grid displays Inventory Items.    Lets say that Item 1 has a qty of 20.   Item 5 has a Qty of 10.
    The list in this grid is based upon the selection of a Location tree.   So it lists the inventory items for a certain location.
    I also have a second tree and grid for the to location inventory items.
    Between the two grids, there is a button which when clicked it iterates thru the selected items and creates a new item in the to list with qty 1 and saves it.  then decreases the current qty in the from list by one.
    So lets say I selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 1 and then saved.   Then the qty in the from list is decreased by 1 and saved and so the vales for 1 is now 19 and for 5 is 9.
    I would like to be able to change the qty in the from list to the qty I want to move.   So when the button is clicked the new item in the to list reflects the new qty and is saved.   Then the previous value of the current qty is decreased by the qty which is displayed in the grid
    So lets say I changed item 1 to 2 and Item 5 to 3 and then selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 2 for item 1 and 3 for item 5 and then saved.   Then the qty in the from list is decreased for Item 1 by 2 and item 5 by 3 and so now Item 1s qty is now 18 and items 5 qty is now 7.
    My first thought was if I had the previous values stored then no big deal.  But I put a break point at the point where the SelectedItems list is being iterated through and the previous values are not stored anywhere. 
    Any suggestions for this?

    ...in the mean time, this should be enough
    win.pnl.list1.onChange = function() {
         alert(this.selection.index); // for this to work set, multiselect:false
    I guess you already tried and the result is "undefined", the reason is you have this property
    multiselect:true
    in that case, selection returns an array,
    this.selection[0].index;
    would give you the first selected item, even if you only have one item selected, to get all selected items loop thru all items in the selection array.
    not sure if Peter's wonderful guide explains this (it is explained in the Tools Guide), but you should read it too, it has tons of great info.

  • How to get the previous value of a field before saving the record

    Hi All,
    I have a requirement like, listing out the modified field values with their previous value and new value using integration events or any method.
    For Ex: If i modify the customer name from "Jack" to "Amith" in the record.
    Then i have a requirement to display the message like : CustomerName has changed from "Jack" to "Amith"
    Please post your help notes on this.It's Urgent.
    Thanks & Regards
    Amith

    Hello Amith,
    How does a user perform the modification? Do you already have access to the existing value when the user makes the update? How are you identifying the record to be updated within CRMOD and what method are you using to perform the update?
    Thanks,
    Sean

  • How to find the PREVIOUS value of a non-DB item?

    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AM

    Channa wrote:
    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AMPlease make it clear what is your requirement then possibly we can provide you a better answer
    You can use Global variables for to store old values also on Post-query populate a value in separate field or Parameter

  • How  to compare previouse value in pl/sql array

    DECLARE
    CURSOR stg_raw_cur IS
    SELECT RAW_STG_ID,
    DEVICE_CD,
    MODEL_VERSION,
    PLATFORM_CD,
    PROFILE_COOKIE,
    LOCATION_CD,
    SAMPLE_RATE,
    EVENT_TYPE_CD,
    to_char(to_date(to_date(substr(EVENT_DATE_TIME,1,8),'yyyymmdd')-1 ||
    'T' ||
    substr(EVENT_DATE_TIME,10,8)
    || 'Z','DD-MON-RR"T"HH24:MI:SS"Z"'), 'YYYYMMDDYY"T"HH24:MI:SS"Z"' ) EVENT_DATE_TIME,
    EVENT_SPECIFIC,
    BATCH_ID,
    DWH_ARVL_DT,
    DWH_ARVL_DT_ID,
    DWH_CREATE_DT from dwh_stg.stg_raw where batch_id >= 200
    order by batch_id asc;
    TYPE stgrawarr IS TABLE OF stg_raw_cur%ROWTYPE;
    stg_raw_rec stgrawarr;
    l_batch_id NUMBER :=0 ;
    v_ctr NUMBER :=0;
    l_temp_batch_id number :=0;
    BEGIN
    OPEN stg_raw_cur;
    LOOP
    FETCH stg_raw_cur BULK COLLECT INTO stg_raw_rec LIMIT 100;
    EXIT
    WHEN stg_raw_cur%NOTFOUND;
    END LOOP;
    CLOSE stg_raw_cur;
    for i in stg_raw_rec.first..stg_raw_rec.last
    loop
    dbms_output.put_line('batch id is '|| stg_raw_rec(i).batch_id );
    IF l_batch_id != stg_raw_rec(i).batch_id
    then
    dbms_output.put_line('Different');
    end if;
    l_temp_batch_id := stg_raw_rec(i).batch_id;
    commit;
    end loop;
    END;
    I want to compare previous value of stg_raw_rec(i).batch_id if differnet then increament the value
    else leave the same.
    thanks.

    Try this,
    FOR i IN stg_raw_rec.FIRST .. stg_raw_rec.LAST
       LOOP
          IF l_temp_batch_id != stg_raw_rec (i).batch_id
          THEN
             --increment
             l_temp_batch_id := l_temp_batch_id + 1;
          END IF;
           DBMS_OUTPUT.PUT_LINE ('batch id is ' || stg_raw_rec (i).batch_id||' unique batch id is '||l_temp_batch_id);
        --  DBMS_OUTPUT.PUT_LINE ('batch id is ' || stg_raw_rec (i).batch_id);
        --  IF l_batch_id != stg_raw_rec (i).batch_id
        --  THEN
        --    DBMS_OUTPUT.PUT_LINE ('Different');
        --  END IF;
          l_temp_batch_id := stg_raw_rec (i).batch_id;
          COMMIT;
       END LOOP;

  • How to get the previous value of Potential Revenue, as Number

    PRE('<Revenue>') will return the previous value of the Potential Revenue (in Opportunity object), as a string.
    However, i need to manipulate the returned value as number in order to evaluate if the previous value is less a certain amount.
    PRE('<Revenue>')*.3204<50000
    The expression about, is meant to convernt the value to a different currency, and evaluate if its less than 50000.
    Is there any way I can be able to achive this?
    appreciate you response! :)
    Edited by: mack on Apr 15, 2012 1:31 AM

    answered.

  • Not able to keep defualt value in UDF Field

    Hello Frnds,
    I have one question to you, I want to keep default value in one of the UDF field which is ContNo which is exist in A/R invoice.
    I want to keep default value =9999999
    So to do this I have followed the following process:-
    First I went to ToolsUser-Defined FieldsManage User FieldsMarketing DocumentsTitleContNo
    then pressing update button there is an option to enter Default value and press OK button.
    After that its taking some 30 mins and giving error of "SEWSY"
    Please help me to let me know the solution.
    Regards,

    Hello Gordon,
    Please note that as per your suggestion now im not updating the udf  by the sql query.
    As i was already trying to update it from as a exclusive user of B1, but its not updating.
    Its always give the error of SEWSY.  At the time of updating there is not user logged on SAP also im updating with the adminstrator role.
    Please suggest me.

Maybe you are looking for

  • How to install the new OS X

    Hello guys .. I know that if i download the new software from the app store i can install it on my macbook air easily .. What i don't know is how to delete the previous OS (i want a install) and when i finish installing the new OS, how do i recover a

  • Help! my skype phone number is not working after b...

    I have a skype number that i recently reactivated. The number is still not working. It gives callers to my number one ring, then a busy signal. What seems to be the problem? i paid for a year of service. Not a 'happy camper' right now!!! Please advis

  • Working On External Segment...Seg Wizard ???

    Hi All, I am facing problem in using "External Segment" Option of Segmentation Wizard. While trying to select external list(CSV file I created) I am gettion option to select only text file. Any idea? Thanks VK Edited by: 793773 on Oct 5, 2010 6:48 AM

  • Disco 3i next page error...

    Some of our reports work fine however others are giving us the following error. We cannot find any reason for the irregularity. When we are in a multi page report and press the next page (or export) link button it goes back to the parameters page. Ot

  • I have received my puc no but i cant put it in my phone because my phone is old

    i cant put my puc number in my phone to unlock because i have a old phone and not a touch screen to changr the letters