Min and Max and insert new rows

Hello,
I am really a beginner in Excel (2007). I am not sure if this is the correct forum, anyway.
I have grouped some rows in a sheet (rows 1, 2 and 3, columns A and B, table below), some of the columns have numeric values in that group and I have a row (inside that group) that shows the maximum and minimum values (row 1):
          A     B 
+  1   43   12 <- MAX and MIN values for row 2 and 3 columns A and B
+  2   34   12
+  3   43   34
I am using MAX and MIN functions: A1 = MAX($A2:$A$3), B1 = MIN($B$2:$B$3)
The problem comes when I want to insert more rows after row 3, the formula keeps wrapping to A$2:$A$3 therefore I need to readjust the formula to: MAX($A2:$A$4) manually (for MIN is the same).
          A     B 
+  1   43   12 <- Are the same, they should be
"98 and  10"
+  2   34   12
+  3   43   34
+  4   98   10 <- New row, but the maximum and minimum continues to be the same, I want to extend the formula automatically to the 4 row when I insert the new row.
Question:
How can I extend the function of the MAX and MIN formula automatically when I insert new rows?
Please consider that I may insert rows at the beginning, in the middle or the end.
Thanks,
Enrique.
Kikeman Electric Systems Engineer

Hi Enrique,
Thanks for posting in MSDN.
Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
End Sub
You can more detail about Excel VBA developing from link below:
Getting Started with VBA in Excel 2010
Welcome to the Excel 2013 developer reference
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Split Oracle 11g Table Partition and Insert new rows

    Hi,
    I have a doubt that i would like to be clarified. I need to split a partition of a table with more than 800 Million records, but at the same time (during the split operation) i need to insert new records (not in the partition that is being splited). Is there any problem/risk doing this? Is the insert ETL process going to fail ?
    Thanks in advance
    Greetings.
    Nuno
    Edited by: user13512889 on 1/Set/2011 3:25

    Hi Enrique,
    Thanks for posting in MSDN.
    Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
    Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
    Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
    End Sub
    You can more detail about Excel VBA developing from link below:
    Getting Started with VBA in Excel 2010
    Welcome to the Excel 2013 developer reference
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Removing rows and inserting new rows with new data in JTAble!!! (Plz. help)

    I have a problem, The scenario is that when I click any folder that si in my JTable's first row, the table is update by removing all the rows and showing only the contents of my selected folder. Right now it's not removing the rows and instead throwing exceptions. The code is attached. The methods to look are upDateTabel(...) and clearTableData(....), after clearing all my rows then I proceed on adding my data to the Jtable and inserting rows but it's not being done. May be I have a problem in my DefaultTableModel class. Please see the code below what I am doing wrong and how should I do it. Any help is appreciated.
    Thanks
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.text.SimpleDateFormat;
    import java.util.*;
    public class SimpleTable extends JPanel{
         /** Formats the date */
         protected SimpleDateFormat           formatter;
    /** variable to hold the date and time in a raw form for the directory*/
    protected long                          dateDirectory;
    /** holds the readable form converted date for the directories*/
    protected String                     dirDate;
    /** holds the readable form converted date for the files*/
    protected String                     fileDate;
    /** variable to hold the date and time in a raw form for the file*/
    protected long                          dateFile;
    /** holds the length of the file in bytes */
    protected long                         totalLen;
    /** convert the length to the wrapper class */
    protected Long                         longe;
    /** Vector to hold the sub directories */
    protected Vector                     subDir;
    /** holds the name of the selected directory */
    protected String                    dirNameHold;
    /** converting vector to an Array and store the values in this */
    protected File                     directoryArray[];
    /** hashtable to store the key-value pair */
    protected static Hashtable hashTable = new Hashtable();
    /** refer to the TableModel that is the default*/
    protected MyTableModel               tableModel;
    /** stores the path of the selected file */
    protected static String               fullPath;
    /** stores the currently selected file */
    protected static File selectedFilename;
    /** stores the extension of the selected file */
    protected static String           extension;
    protected int COLUMN_COUNT = 4;
         protected Vector data = new Vector( 0, 1 );
         protected final JTable table;
    /** holds the names of the columns */
    protected final String columnNames[] = {"Name", "Size", "Type", "Modified"};
    public SimpleTable(File directoryArray[])
              this.setLayout(new BorderLayout());
              this.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 0 ) );
              (SimpleTable.hashTable).clear();
              formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm aaa");
              for(int k = 0; k < directoryArray.length; k++)
                   if(directoryArray[k].isDirectory())
                        dateDirectory = directoryArray[k].lastModified();
                        dirDate = formatter.format(new java.util.Date(dateDirectory));
                        data.addElement( new MyObj( directoryArray[k].getName(), "", "File Folder", "" + dirDate ) );
                        (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);                    
                   else if(directoryArray[k].isFile())
                        dateDirectory = directoryArray[k].lastModified();
                        fileDate = formatter.format(new java.util.Date(dateDirectory));
                        totalLen = directoryArray[k].length();
                        longe = new Long(totalLen);
                        data.addElement( new MyObj( directoryArray[k].getName(), longe + " Bytes", "", "" + fileDate ) );
                        (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);
    tableModel = new MyTableModel();
              table = new JTable( tableModel );
              table.getTableHeader().setReorderingAllowed(false);
              table.setRowSelectionAllowed(false);
              table.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 0 ) );
              table.setShowHorizontalLines(false);
              table.setShowVerticalLines(false);
              table.addMouseListener(new MouseAdapter()
    public void mouseReleased(MouseEvent e)
         Object eventTarget = e.getSource();
                        if( eventTarget == table )
                             upDateTable(table);
                             table.tableChanged( new javax.swing.event.TableModelEvent(tableModel) ) ;
              DefaultTableCellRenderer D_headerRenderer = (DefaultTableCellRenderer ) table.getTableHeader().getDefaultRenderer();
              table.getColumnModel().getColumn(0).setHeaderRenderer(D_headerRenderer );
              ((DefaultTableCellRenderer)D_headerRenderer).setToolTipText("File and Folder in the Current Folder");
    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    //Add the scroll pane to this window.
    this.add(scrollPane, BorderLayout.CENTER);
    * Searches the Hashtable and returns the path of the folder or the value.
    public File findPath(String value)
         return (File)((SimpleTable.hashTable).get(value));
    * This clears the previous data in the JTable
    public void clearTableData(JTable table)
         for(int row = 0; row < table.getRowCount() ; row++)
                   //for (int col = 0; col < table.getColumnCount() ; col++)
                        tableModel.deleteSelections( row );
              tableModel.fireTableStructureChanged();
              tableModel.fireTableRowsDeleted(0,table.getRowCount());
              //table.getModel().fireTableChanged(new TableModelEvent(table.getModel()));
    private void upDateTable(JTable table)
    if((table.getSelectedColumn() == 0) && ((table.getColumnName(0)).equals(columnNames[0])))
         dirNameHold =(String) table.getValueAt(table.getSelectedRow(),table.getSelectedColumn());
                   File argument = findPath(dirNameHold);
                   if(argument.isFile())
                        CMRDialog.fileNameTextField.setText(argument.getName());
                        try
                             fullPath = argument.getCanonicalPath();                          
                             selectedFilename = argument.getCanonicalFile();                          
    CMRDialog.filtersComboBox.removeAllItems();
                             extension = fullPath.substring(fullPath.lastIndexOf('.'));
                             CMRDialog.filtersComboBox.addItem("( " + extension + " )" + " File");
                        catch(IOException e)
                             System.out.println("THE ERROR IS " + e);
                        return;
                   else if(argument.isDirectory())
                        String path = argument.getName();
                             //find the system dependent file separator
                             //String fileSeparator = System.getProperty("file.separator");
                        CMRDialog.driveComboBox.addItem(" " + path);
              subDir = Search.subDirs(argument);
              /**TBD:- needs a method to convert the vector to an array and return the array */
              directoryArray = new File[subDir.size()];
                   int indexCount = 0;
                   /** TBD:- This is inefficient way of converting a vector to an array */               
                   Iterator e = subDir.iterator();               
                   while( e.hasNext() )
                        directoryArray[indexCount] = (File)e.next();
                        indexCount++;
              /** now calls this method and clears the previous data */
              clearTableData(table);     
                   (SimpleTable.hashTable).clear();
                   //data = new Object[this.getRowTotal(directoryArray)][this.getColumnTotal()];
                   formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm aaa");
                   for(int k = 0; k < directoryArray.length; k++)
                        if(directoryArray[k].isDirectory())
                             dateDirectory = directoryArray[k].lastModified();
                             dirDate = formatter.format(new java.util.Date(dateDirectory));
                             data.addElement( new MyObj( directoryArray[k].getName(), "", "File Folder", "" + dirDate ) );
                             (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);                    
                        else if(directoryArray[k].isFile())
                             dateDirectory = directoryArray[k].lastModified();
                             fileDate = formatter.format(new java.util.Date(dateDirectory));
                             totalLen = directoryArray[k].length();
                             longe = new Long(totalLen);
                             data.addElement( new MyObj( directoryArray[k].getName(), longe + " Bytes", "", "" + fileDate ) );
                             (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);
              // tableModel.fireTableDataChanged();          
              // tableModel.fireTableRowsInserted(0,1);
              table.revalidate();
              table.validate();               
    class MyTableModel extends DefaultTableModel
              int totalRows;
              int totalCols;
              public MyTableModel()
                   super();
                   setColumnIdentifiers (columnNames);
                   this.totalRows = data.size();
                   this.totalCols = columnNames.length;
              // this will return the row count of your table
              public int getRowCount()
                   return totalRows;
              // this return the column count of your table
              public int getColumnCount()
                   return totalCols;
              // this return the data for each cell in your table
              public Object getValueAt(int row, int col)
                   MyObj obj = (MyObj)data.elementAt( row );
                   if( obj != null )
                        if( col == 0 ) return( obj.first );
                        else if( col == 1 ) return( obj.last );
                        else if( col == 2 ) return( obj.third );
                        else if( col == 3 ) return( obj.fourth );
                        else return( "" );
                   return "";
              // if you want your table to be editable then return true
              public boolean isCellEditable(int row, int col)
                   return false;
              // if your table is editable edit the data vector here and
              // call table.tableChanged(...)
              public void setValueAt(Object value, int row, int col)
              protected void deleteSelections (int rows)
                   try
                        removeRow(rows);
                   catch(ArrayIndexOutOfBoundsException e)
                        System.out.println("The error in the row index " + rows);
                   fireTableDataChanged() ;
    class MyObj
              String first;
              String last;
              String third;
              String fourth;
              public MyObj( String f, String l, String t, String fo )
                   this.first = f;
                   this.last = l;
                   this.third = t;
                   this.fourth = fo;
    #####################################

    The following code works fine but it doesn't show me the new updated date in my JTable. I tried to print the values that I am getting and it does give the values on the prompt but doesn't show me on the JTable only first two are shown and the rest of the table is filled with the same values. I don't know what's going on and am tired of this TableModel thing so pla. take a time to give me some suggestions. Thanks
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.text.SimpleDateFormat;
    import java.util.*;
    public class SimpleTable extends JPanel {
         /** Formats the date */
         protected SimpleDateFormat           formatter;
    /** two-dimensional array to hold the information for each column */
    protected Object                     data[][];
    /** variable to hold the date and time in a raw form for the directory*/
    protected long                          dateDirectory;
    /** holds the readable form converted date for the directories*/
    protected String                     dirDate;
    /** holds the readable form converted date for the files*/
    protected String                     fileDate;
    /** variable to hold the date and time in a raw form for the file*/
    protected long                          dateFile;
    /** holds the length of the file in bytes */
    protected long                         totalLen;
    /** convert the length to the wrapper class */
    protected Long                         longe;
    /** Vector to hold the sub directories */
    protected Vector                     subDir;
    /** holds the name of the selected directory */
    protected String                    dirNameHold;
    /** converting vector to an Array and store the values in this */
    protected File                     directoryArray[];
    /** hashtable to store the key-value pair */
    protected static Hashtable hashTable = new Hashtable();
    /** refer to the TableModel that is the default*/
    protected DefaultTableModel      model;
    /** stores the path of the selected file */
    protected static String               fullPath;
    /** stores the currently selected file */
    protected static File selectedFilename;
    /** stores the extension of the selected file */
    protected static String           extension;
    protected Vector                     m = new Vector(0,1);
    /** holds the names of the columns */
    protected final String columnNames[] = {"Name", "Size", "Type", "Modified"};
    public SimpleTable(File directoryArray[])
              this.setLayout(new BorderLayout());
              this.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 0 ) );
              (SimpleTable.hashTable).clear();
              data = new Object[this.getRowTotal(directoryArray)][this.getColumnTotal()];
              formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm aaa");
              for(int k = 0; k < directoryArray.length; k++)
                   if(directoryArray[k].isDirectory())
                        data[k][0] = directoryArray[k].getName();
                        data[k][2] = "File Folder";
                        dateDirectory = directoryArray[k].lastModified();
                        dirDate = formatter.format(new java.util.Date(dateDirectory));
                        data[k][3] = dirDate;
                        (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);                    
                   else if(directoryArray[k].isFile())
                        data[k][0] = directoryArray[k].getName();
                        totalLen = directoryArray[k].length();
                        longe = new Long(totalLen);
                        data[k][1] = longe + " Bytes";
                        dateFile = directoryArray[k].lastModified();
                        fileDate = formatter.format(new java.util.Date(dateFile));
                        data[k][3] = fileDate;
                        (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);
    model = new DefaultTableModel();
    model.addTableModelListener( new TableModelListener(){
              public void tableChanged( javax.swing.event.TableModelEvent e )
                   System.out.println("************ I am inside the table changed method ********" );
              final JTable table = new JTable(model);
              table.getTableHeader().setReorderingAllowed(false);
              table.setRowSelectionAllowed(false);
              table.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 0 ) );
              table.setShowHorizontalLines(false);
              table.setShowVerticalLines(false);
              table.addMouseListener(new MouseAdapter()
    /* public void mousePressed(MouseEvent e)
    //System.out.println("The clicked component is " + table.rowAtPoint(e.getPoint()) + "AND the number of clicks is " + e.getClickCount());
    /* if(e.getClickCount() >= 2 &&
    (table.getSelectedColumn() == 0) &&
    ((table.getColumnName(0)).equals(columnNames[0])))
         //System.out.println("The clicked component is " + table.rowAtPoint(e.getPoint()) + "AND the number of clicks is " + e.getClickCount());
         upDateTable(table);
    public void mouseReleased(MouseEvent e)
    //System.out.println("The clicked component is " + table.rowAtPoint(e.getPoint()) + "AND the number of clicks is " + e.getClickCount());
    /* if(e.getClickCount() >= 2 &&
    (table.getSelectedColumn() == 0) &&
    ((table.getColumnName(0)).equals(columnNames[0]))) */
         //System.out.println("The clicked component is " + table.rowAtPoint(e.getPoint()) + "AND the number of clicks is " + e.getClickCount());
         upDateTable(table);
              /** set the columns */
              for(int c = 0; c < columnNames.length; c++)
                   model.addColumn(columnNames[c]);
              /** set the rows */
              for(int r = 0; r < data.length; r++)
                   model.addRow(data[r]);
              DefaultTableCellRenderer D_headerRenderer = (DefaultTableCellRenderer ) table.getTableHeader().getDefaultRenderer();
              table.getColumnModel().getColumn(0).setHeaderRenderer(D_headerRenderer );
              ((DefaultTableCellRenderer)D_headerRenderer).setToolTipText("File and Folder in the Current Folder");
    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    //Add the scroll pane to this window.
    this.add(scrollPane, BorderLayout.CENTER);
    * Returns the number of columns
    public int getColumnTotal()
         return columnNames.length;
    * Returns the number of rows
    public int getRowTotal(Object directoryArray[])
         return directoryArray.length;
    private void upDateTable(JTable table)
    if((table.getSelectedColumn() == 0) && ((table.getColumnName(0)).equals(columnNames[0])))
         dirNameHold =(String) table.getValueAt(table.getSelectedRow(),table.getSelectedColumn());
                   File argument = findPath(dirNameHold);
                   if(argument.isFile())
                        CMRDialog.fileNameTextField.setText(argument.getName());
                        try
                             fullPath = argument.getCanonicalPath();                          
                             selectedFilename = argument.getCanonicalFile();                          
    CMRDialog.filtersComboBox.removeAllItems();
                             extension = fullPath.substring(fullPath.lastIndexOf('.'));
                             CMRDialog.filtersComboBox.addItem("( " + extension + " )" + " File");
                        catch(IOException e)
                             System.out.println("THE ERROR IS " + e);
                        return;
                   else if(argument.isDirectory())
                        String path = argument.getName();
                             //find the system dependent file separator
                             //String fileSeparator = System.getProperty("file.separator");
                        CMRDialog.driveComboBox.addItem(" " + path);
              subDir = Search.subDirs(argument);
              /**TBD:- needs a method to convert the vector to an array and return the array */
              directoryArray = new File[subDir.size()];
                   int indexCount = 0;
                   /** TBD:- This is inefficient way of converting a vector to an array */               
                   Iterator e = subDir.iterator();               
                   while( e.hasNext() )
                        directoryArray[indexCount] = (File)e.next();
                        indexCount++;
              /** now calls this method and clears the previous data */
              clearTableData(table);     
                   (SimpleTable.hashTable).clear();
                   data = new Object[this.getRowTotal(directoryArray)][this.getColumnTotal()];
                   formatter = new SimpleDateFormat("mm/dd/yyyy hh:mm aaa");
                   m.clear();
                   data = null;
                   data = new Object[this.getRowTotal(directoryArray)][this.getColumnTotal()];
                   for(int k = 0; k < directoryArray.length; k++)
                        if(directoryArray[k].isDirectory())
                        System.out.println("Inside the if part");
                             data[k][0] = directoryArray[k].getName();
                             table.setValueAt(directoryArray[k].getName(),k,0);
                             //model.fireTableCellUpdated(k,0);
                             data[k][2] = "File Folder";
                             table.setValueAt("File Folder",k,2);
                             //model.fireTableCellUpdated(k,2);
                             dateDirectory = directoryArray[k].lastModified();
                             dirDate = formatter.format(new java.util.Date(dateDirectory));
                             data[k][3] = dirDate;
                             table.setValueAt(dirDate,k,3);
                             //model.fireTableCellUpdated(k,3);
                             (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);
                             m.add(data);
                             model.addRow(m);
                             model.fireTableDataChanged();                              
                        else if(directoryArray[k].isFile())
                   System.out.println("******* Inside the else part *******");
                             data[k][0] = directoryArray[k].getName();
                   System.out.println("The Name is == " + data[k][0]);
                             table.setValueAt(directoryArray[k].getName(),k,0);
                   System.out.println("The table cell value of the name is == " + table.getValueAt(k,0));
                             //model.fireTableCellUpdated(k,0);
                             totalLen = directoryArray[k].length();
                             longe = new Long(totalLen);
                             data[k][1] = longe + " Bytes";
                   System.out.println("The length == " + data[k][1]);
                             table.setValueAt(longe + " Bytes",k,1);
                   System.out.println("The table cell value of the length is == " + table.getValueAt(k,1));
                             //model.fireTableCellUpdated(k,0);
                             dateFile = directoryArray[k].lastModified();
                             fileDate = formatter.format(new java.util.Date(dateFile));
                             data[k][3] = fileDate;
                   System.out.println("The modified date == " + data[k][3]);
                             table.setValueAt(fileDate,k,3);
                   System.out.println("The table cell value of the name is == " + table.getValueAt(k,3));
                             //model.fireTableCellUpdated(k,0);
                             (SimpleTable.hashTable).put(directoryArray[k].getName(), directoryArray[k]);                    }
                             m.add(data);
                             model.addRow(m);
                             model.fireTableDataChanged();     
              // model.fireTableDataChanged();          
              // model.fireTableRowsInserted(0,1);
              table.revalidate();
              table.validate();               
         else
    * Searches the Hashtable and returns the path of the folder or the value.
    public File findPath(String value)
         return (File)((SimpleTable.hashTable).get(value));
    * This clears the previous data in the JTable
    public void clearTableData(JTable table)
         for(int row = 0; row < table.getRowCount() ; row++)
                   for (int col = 0; col < table.getColumnCount() ; col++)
                        table.setValueAt(null, row , col);
              model.fireTableStructureChanged();
    ###

  • Receiver JDBC: Error while doing the Deleting and Inserting new records

    Hi All,
              I am doing Idoc to JDBC scenario. In this I am collecting & bundling different type of Idocs and then sending to the JDBC receiver. My requirement is to delete the existing records in the database and insert the new records. I have configures as mentioned in the link
    Re: Combining DELETE and INSERT statements in JDBC receiver
    In the above link its shows for single mapping. In my scenario I am using multi mapping for collecting idocs in BPM. If I configured for normal mapping then it is working fine(Deleting existing records and Inserting new record). Whenever I am using multi mapping then I am getting following error in the receiver JDBC communication channel u201CError while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)u201D . Can you please tell me what might be the problem.
    Thanks & Regards,
    T.Purushotham

    Hi !
    check this out:
    JDBC - No 'action' attribute found in XML document - error
    JDBC receiver adapter: No 'action' attribute found in XML document
    It appears that the inbound payload (the one that is going from XI to the JDBC adapter) does not have the requiered tag to specify which SQL action to execute in the receiver system. Maybe the multimapping is not creating the desired output message format.
    Regards,
    Matias.

  • BOM Change - Delete an item(s) and insert new line items

    Hi,
    We need to mass update BOMs like for some of the existing BOM's we need to delete some line items and insert new line items. We want to use the BOMMAT04 IDOC in LSMW but I'd like to know couple of things before I go ahead with that approach
    For instance, I've a finished good material 12345678 and it has three components
                          a) Item 0010 Material 30101010 of quantity 10
                          b) Item 0020 Material 30101011 of quantity 11
                          C) Item 0030 Material 30101012 of quantity 12
    Now, I'd like delete Item 0010 and add a new item 0040 Material 30101013 of quantity 13. 
    In the segment E1STKOM, there is LOEKZ (Deletion Flag) but I dont want to flag for deletion but instead delete the whole line item and add a new line item.
    Is there any way to achieve this using BOMMAT04 IDOC? If not, can you please suggest me a better way to do it
    Any help is greatly appreciated
    Thanks,
    Srinivas

    Dear Srinivas,
    1.IF you want to change for an individual BOM,use CS02,select the item which you want to delete,select the entire and click on
    delete button and then add new line items and save.
    2.For Mass changes of BOM you can use CS20.
    3.Check these functional module's also if you want to change using a report,
    CS_BI_BOM_CHANGE_BATCH_INPUT   Change bill of material via batch input    
    CSEP_MAT_BOM_SELECT_CHANGE     API Bills of Material: Select BOM(s)    
    CS_CL_P_BOM_MASS_CHANGE     
    CS_CL_S_BOM_CHANGE_COMPLETE 
    Check and revert back,.
    Regards
    Mangalraj.S

  • I have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    i have changed provider and inserted new sim but it shows 'sim not valid' does anyone know how to unlock iPhone 5?

    Yes, contact the carrier the iPhone is locked to.
    Only they can officially unlock the iPhone and if you qualify. No one else.

  • ODI - SCD Type 2 - Insert new row error

    Hi All,
    For Dimension I have a surrogate key, a natural key, and a column with "overwrite on change", start_date, end_date, current_record_ind. When I run the interface with the default SCD Type 2 for SQl server, this runs fine. But when I change that one column from "overwrite on change" to "insert new row", it fails on the update step. What should I be looking for anf fixing.
    Thanks for your time and help.

    DB: SQL Server 2008.
    IKM = IKM MSSQL Slowly Changing Dimension
    Error Message: ODI-1228 - Incorrect syntax near the keyword from.
    Code: update T
    set
    from database.dbo.Dim_type as T,
    database.dbo.I$_Dim_type as S
    where T.Cd = S.Cd
    and T.Current_rec_ind = 1
    and IND_UPDATE = 'U'
    To overcome the issue, I have commented the update code in the Knowledge module and the insert works, but for this one it is ok, but I have requirements where one column needs to be overwritten and other column changes will require to add a new record. How to handle both?
    Thanks for your time.

  • Insert new row to master - detail form using bindingsource

    Hi all,
    I have a form to analyse price of product, the form include master (textbox:slip ID,datetimepicker : date) and detail(datagridview:slipID,productID,price..)
    When I insert new row as below code, all inserted to DB but not show on form, I must close and reopen the form the new row will show, how i must to do to fix it 
    please help, thanks
    Select data when form load 
    ds = New DataSet
    damaster = New SqlDataAdapter("select soPTG,ngaybd,ngaykt,khoa = case when sttesign =0 then 'True' else 'False' end from tbl_PTGMaster", conn)
    damaster.Fill(ds, "tbl_ptgMaster")
    dadet = New SqlDataAdapter("select [SoPTG],[Mahang],[gianhap],[thuesuat],[laigop],[giacu],[giamoi] from tbl_PTGDetail", conn)
    dadet.Fill(ds, "tbl_ptgdetail")
    ds.Relations.Add("PTG_rel", ds.Tables("tbl_ptgmaster").Columns("SoPTG"), ds.Tables("tbl_ptgdetail").Columns("SoPTG")).ChildKeyConstraint.UpdateRule = Rule.Cascade
    BindingMaster.DataSource = ds
    BindingMaster.DataMember = "tbl_ptgmaster"
    BindingDetail.DataSource = BindingMaster
    BindingDetail.DataMember = "PTG_rel"
    gridchitiet.DataMember = "tbl_ptgdetail"
    txtptgnumb.DataBindings.Add("text", BindingMaster, "soPTG")
    dtstart.DataBindings.Add("Text", BindingMaster, "ngaybd")
    dtend.DataBindings.Add("Text", BindingMaster, "ngaykt")
    cmdlock.DataBinding.Add("Enabled", BindingMaster, "khoa", True, DataSourceUpdateMode.OnPropertyChanged)
    setStatus()
    SetHeader()
    Dim cmdinsert As New SqlCommand("insert into tbl_PTGMaster(SoPTG,ngaybd,ngaykt) values(@SoPTG,@ngaybd,@ngaykt)", conn)
    cmdinsert.Parameters.Add("@soPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
    cmdinsert.Parameters.Add("@ngaybd", SqlDbType.DateTime).Value = dtstart.Value
    cmdinsert.Parameters.Add("@ngaykt", SqlDbType.DateTime).Value = dtend.Value
    damaster.InsertCommand = cmdinsert
    damaster.FillSchema(ds, SchemaType.Source)
    cmdinsert = New SqlCommand("insert into tbl_PTGDetail(SoPTG,mahang,gianhap) values(@SoPTG,@mahang,@gianhap)", conn)
    cmdinsert.Parameters.Add("@SoPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
    cmdinsert.Parameters("@SoPTG").Direction = ParameterDirection.InputOutput
    cmdinsert.Parameters.Add("@mahang", SqlDbType.Char, 10, "mahang")
    cmdinsert.Parameters.Add("@gianhap", SqlDbType.Decimal, 8, "gianhap")
    dadet.InsertCommand = cmdinsert
    dadet.FillSchema(ds, SchemaType.Source)
    gridchitiet.FinishEditing()
    BindingMaster.EndEdit()
    damaster.Update(ds, "tbl_PTGMaster")
    ds.Tables("tbl_PTGMaster").AcceptChanges()
    BindingDetail.EndEdit()
    dadet.Update(ds, "tbl_PTGDetail")
    ds.Tables("tbl_PTGDetail").AcceptChanges()
    BindingMaster.ResetBindings(False)
    BindingDetail.ResetBindings(False)

    Hello,
    The base idea here is if the record is added successfully you would then get the new primary key then manually add the record to the underlying data source. Does not matter if we are talking a single table or a master-detail setup.
    The following shows the basics
    https://code.msdn.microsoft.com/Adding-new-records-into-bff5eaaf 
    All of the above is done without using a DataSet yet the same thing needs to happen with a DataSet, simply focus on the one table.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Query to calculate value and produce new rows

    QUARTER CUSTOMER PRODUCT RETAIL_SALES_AMT     WHOLESALE_AMT
    01/01/2006     ABC VACCUM CLEANER 454234.00 65633456.00
    04/01/2006     ABC VACCUM CLEANER 324562.00 45333234.00
    07/01/2006     ABC VACCUM CLEANER NULL 67845423.00
    10/01/2006     ABC VACCUM CLEANER NULL 67453453.00
    01/01/2007     ABC VACCUM CLEANER NULL 56754633.00
    04/01/2007     ABC VACCUM CLEANER NULL 45423434.00
    Hi guys,
    It is a situation where i have to produce some new rows with projected RETAIL_SALES_AMT based on the last quarter's
    RETAIL_SALES_AMOUNT and next quarte'rs WHOLESALE_AMT. As you can see from the sample data for a specific customer,
    product i have retail_sales_amt populated only upto 04/01/2006 but WHOLE_SALE amt for the same product and customer
    are there upto 04/01/2007.
    I have to produce a PROJECTED RETAIL_SALES_AMT and it should be inserted as a new row with a flag to identify
    a projected row. Here in this case i have to produce a new row for 07/01/2006,10/01/2006 & 01/01/2007 projecting
    the RETAIL_SALES_AMT. The formulae for calculation is as under:
    projected retail_sales_amt for 07/01/2006=.345+( (07/01/2006 whole_sales - 04/01/2006 whole_sales)/(04/01/2006 whole_sale)))
    *04/01/2006 RETAIL_SALES_AMT and going forward for subsequent quarters.
    Is there any way i can use a query to produce these new rows by calculating the RETAIL_SALES_AMT on the fly or any
    procedural way to do it.
    Please help as it looks a bit complicated logic.
    Regards
    Edited by: user626688 on Oct 27, 2009 11:26 AM
    Edited by: user626688 on Oct 27, 2009 11:26 AM
    Edited by: user626688 on Oct 27, 2009 11:27 AM
    Edited by: user626688 on Oct 27, 2009 11:28 AM
    Edited by: user626688 on Oct 27, 2009 11:31 AM
    Edited by: user626688 on Oct 27, 2009 11:32 AM

    I'm not sure if this is exactly what you want but this shows you the possibilities:
    WITH sales_table AS
            SELECT TO_DATE('01/01/2006','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, 454234 AS RETAIL_SALES_AMT, 65633456 AS WHOLESALE_AMT FROM DUAL UNION ALL
            SELECT TO_DATE('04/01/2006','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, 324562 AS RETAIL_SALES_AMT, 45333234 AS WHOLESALE_AMT FROM DUAL UNION ALL
            SELECT TO_DATE('07/01/2006','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, NULL AS RETAIL_SALES_AMT, 67845423 AS WHOLESALE_AMT FROM DUAL UNION ALL
            SELECT TO_DATE('10/01/2006','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, NULL AS RETAIL_SALES_AMT, 67453453 AS WHOLESALE_AMT FROM DUAL UNION ALL
            SELECT TO_DATE('01/01/2007','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, NULL AS RETAIL_SALES_AMT, 56754633 AS WHOLESALE_AMT FROM DUAL UNION ALL
            SELECT TO_DATE('04/01/2007','MM/DD/YYYY') AS QUARTER, 'ABC' AS CUSTOMER, 'VACUUM CLEANER' AS PRODUCT, NULL AS RETAIL_SALES_AMT, 45423434 AS WHOLESALE_AMT FROM DUAL
    SELECT  QUARTER
    ,       CUSTOMER
    ,       PRODUCT
    ,       RETAIL_SALES_AMT
    ,       WHOLESALE_AMT
    ,       PROJECTED_FLG
    FROM    SALES_TABLE
    MODEL
            DIMENSION BY
                    QUARTER
            ,       CUSTOMER
            ,       PRODUCT
            MEASURES
                    RETAIL_SALES_AMT
            ,       WHOLESALE_AMT
            ,        'F' AS PROJECTED_FLG
            RULES
                    PROJECTED_FLG[ANY,ANY,ANY] =  (CASE
                                                                            WHEN RETAIL_SALES_AMT[cv(),cv(),cv()] IS NULL AND RETAIL_SALES_AMT[cv(),cv(),cv()] IS PRESENT
                                                                            THEN 'T'
                                                                            ELSE 'F'
                                     END)
             ,     RETAIL_SALES_AMT[ANY,ANY,ANY] = (CASE
                                                            WHEN RETAIL_SALES_AMT[cv(),cv(),cv()] IS NULL AND RETAIL_SALES_AMT[cv(),cv(),cv()] IS PRESENT
                                                            THEN RETAIL_SALES_AMT[ADD_MONTHS(cv(),-3),cv(),cv()]*(.345 + ((WHOLESALE_AMT[cv(),cv(),cv()] - WHOLESALE_AMT[ADD_MONTHS(cv(),-3),cv(),cv()])/WHOLESALE_AMT[ADD_MONTHS(cv(),-3),cv(),cv()]))
                                                    ELSE
                                                    RETAIL_SALES_AMT[cv(),cv(),cv()]
                                                    END)     
    ORDER BY 1, 2, 3Results:
    QUARTER             CUS PRODUCT        RETAIL_SALES_AMT WHOLESALE_AMT P
    01/01/2006 00:00:00 ABC VACUUM CLEANER           454234      65633456 F
    04/01/2006 00:00:00 ABC VACUUM CLEANER           324562      45333234 F
    07/01/2006 00:00:00 ABC VACUUM CLEANER       273149.267      67845423 T
    10/01/2006 00:00:00 ABC VACUUM CLEANER       92658.4052      67453453 T
    01/01/2007 00:00:00 ABC VACUUM CLEANER       17270.5619      56754633 T
    04/01/2007 00:00:00 ABC VACUUM CLEANER       2510.23463      45423434 TEdited by: Centinul on Oct 27, 2009 3:00 PM

  • Updating ROW and inserting multiple row

    Hello,
    I needed some help.
    Firstly, i have VO which has 2 EO, these 2 EO are linked with association.
    In my page, i have a table, which by default has one row, and few fields can be edited, on click of "Apply" i want to commit this data,
    but when i use " getOADBTransaction().commit();" it gives me primary key constraint error.
    Secondly, when i click on add row button, it adds new row with unique primary key, also copying few attributes from existing first row.
    So, now when i want to update this table, since this VO is based on 2 EO's which are linked , i can't insert completely since in second EO parent EO's primary key is not inserted.
    Please help.

    I created new VO.
    It is EO based.
    Again, Commit is not working.
    code is
    public void create_row()
    SplitAtsVOImpl svo = getSplitAtsVO1();
    Row row = svo.first();
    Row r = svo.createRow();
    for(int i =1;i<row.getAttributeCount();i++)
    {System.out.println(i+"          "+row.getAttribute(i));
               if(row.getAttribute(i)!=null&&i<27)
             r.setAttribute(i,row.getAttribute(i).toString());
    r.setAttribute("DispAssNum",""+r.getAttribute("AssetNum")+"-"+count);
    r.setAttribute("AtsAssetId",getOADBTransaction().getSequenceValue("ATS_ASSET_TBL_S").toString());
    System.out.println(r.getAttribute("AtsAssetId"));
    r.setNewRowState(Row.STATUS_INITIALIZED);
    //r.setAttribute("AtsAssetId1",(""+row.getAttribute("AtsAssetId")));
    System.out.println(svo.getRowCount());
    svo.insertRowAtRangeIndex(0,r);
    try
    getOADBTransaction().commit();
    catch(OAException e)
    System.out.println(e.toString());
    }

  • Soritng and inserting the rows of a bitset matrix....Brain teaser!!!

    Initially, i have two bitset matrices:
    1. temp_matrix:Initially, it has all the rows,say n, in the sorted order based on their cradinality.
    2.Final_matrix:Intially, empty.
    Operation being performed on the bitset matrice:
    1. Take each row of temp_matrix and perform "and" operation of it with all the other rows underneath it.Take the second row and perform and operation with all the orther rows underneath it and repeat the same with all the other rows till u reach the n-1the row which will be "Anded" with nth row.
    2."Anded" result of each of two rows has to be stored in the Final_matrix in a sorted order based on its cardinality.
    For example: say at any instant Final_matrix had the following state:
    {1}
    {3}
    {1,2,3}
    {3,4,5,6}
    {1,2,3,4,5,6}
    And suppose i have to insert a new row say: {4} in it at 3rd position
    How should i do that..i mean which sorting method will be time efficent and how should i implement it in terms of inserting a new row in the list with the issues of shifting the rows etc.
    The datastructure i am using is BitSet to store the bits.
    Any suggestions !!!

    Can u tell me how to wrap the BitSet entries in the Linked Lists.
    I am pasting snap shot of my code,if that helps:
    for( i=0;i<count_bit_vector_global-n;i=i+n)
    long initial=0;
    initial= System.currentTimeMillis();
    count_j=0;
    for(int j=i;j<i+n;j++)
    if(temp_vector1.get(j)==true)
    result_row_vector.set(count_j);
    else
    result_row_vector.clear(count_j);
    count_j++;
    }/*End for j:Result row created*/
    if(result_row_vector.cardinality()>num_one)
    for(int k=(i+n);k<count_bit_vector_global;k=k+n)
    check=0;
    if((temp_vector1.get(i,i+n)).intersects(temp_vector1.get(k,k+n))==true)/*All result elements are not zero*/
    count_j=0;
    for(int j=i;j<i+n;j++)
    if(temp_vector1.get(j)==true)
    result_row_vector.set(count_j);
    else
    result_row_vector.clear(count_j);
    count_j++;
    result_row_vector.and(temp_vector1.get(k,k+n));
    while(check<count_bit_vector)
    if((result_row_vector.get(0,count_j)).equals(bit_vector1.get(check,check+n)))
    flag=true;
    s2=track_vector.get(check/n).toString();
    s1= temp_track_vector.get(i/n).toString().concat(b).concat(temp_track_vector.get(k/n).toString());
    track_vector.set(check/n,concat_string(s2,s1));
    break;
    else
    flag=false;
         check=check+n;
    }/*End while*/
    In this code n decides the length of one row.U can see i am simulating a 1D BitSet as 2D BitSet matrix.
    Do pay any heed to the track_vector.
    But i will summarize what i am doing here.
    Temp_vector1 is the initial bitset storing the original matrix.
    bit_vector1 is the bitset storing the new "Anded" rows.
    "i" decides which row will be compared to all the other rows after that.
    "k" decides the rows which are after the row determined by "i".
    I am taking the row decided by "i" and then store that in result_vector and then "And" it with the other rows decided by "k".
    "count_bit_vector" tells the number of bit elements in temp_vector
    "check" tells the position of the row in the bit_vector1 which is similer to the row obtained after "And" operation.
    If i find the row i don't add it in the bit_vector1 but if its not there then it is added.
    Right now, before rejecting a row i have to compare all the rows which are there in the bit_vector1 and that is taking time.

  • Subtracting and Inserting new field

    Hi,
    I have a table:
    Metric          MetricDescription                       Season    Measure
    01                       Cancellation                      Ho11        
     3
    03                           GF                                HO11         
    4
    I need to make a new Row Based on Same season. I need to subtract GF- Cancellation  and call it NS with 46 metric. So my table should look like
    Metric          MetricDescription                       Season    Measure
    01                       Cancellation                      Ho11        
     3
    03                           GF                                HO11         
    4
    46                          NS                                
    HO11          1
    Any Suggestion?
    SPPandey

    I do have something like this but not sure how to do a subtraction o my select statement:
    Insert Into Table_A
    (Metric,
    MetricDecription,
    Season,
    Measure)
    select
    (Metric,
    MetricDecription,
    Season,
    Measure----  This is where I need to Insert that formula)
    where Metric= '01'   or  Metric ='03'
    group by....
    SPPandey

  • How can I Add and save new row in data table?

    Hello All,
    I want to add new row in the jsf page with data and save it.
    I have data table with rows from database..
      <h:form id="test">
            <h:dataTable id="hh" value="#{MyBean.dataList}" var="list">
              <h:column>
              <h:outputText value="#{list.name}"/>          
              </h:column>         
              <h:column>
              <h:outputText value="#{list.lastName}"/>          
              </h:column>         
              <h:column>
              <h:outputText value="#{list.phone}"/>          
              </h:column>         
            </h:dataTable>
            <h:commandButton id="sd" action="#{MyBean.addNewRow" value="Add Row" />
            <h:commandButton id="save" action="#{MyBean.updateList" value="Save Data />
          </h:form>
    {code}
    i understand action with save to database, but still I could not find right way to add new row from jsf page.....
    I want add new row, add new name, lastname, and save it....
    Edited by: armen on Feb 20, 2009 12:39 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Thanks, but your example consist from too many parts and I could not join all components for understatnding all proccess.

  • Trains Stops and Insert new data using invokeAction!?

    Hi! I am using Train element to insert data in some tables. When I open first Train Step I use invokeAction to call CreateInsert operation and could insert new data in table1. Then I go to Train Step 2 and using invokeAction insert data in table2 and so on.
    I have two questions:
    1. When I go back to previous Train Step using "Back" button then invokeAction again calls CreateInsert operation, but I don't need it. It is possible to call CreateInsert operation using invokeAction ONLY if user goes forward by pressing "Next" button in Train element? If it is possible then What I need to change in my code?
    invokeAction source:
    <invokeAction Binds="CreateInsert" id="insert_mode"
                      RefreshCondition="${!requestContext.postback and empty bindings.exceptionsList}"
                      Refresh="prepareModel"/>2. It is possible to DISABLE some Train Stopas. For example, I want to disable first Train Stop for user when he go to next steps, so that user can't anymore go back to first Train Stop.
    Hope for Your answers, best regards, Debuger!

    Hi, Umesh! My use case is following: I am on first Train Stop and enter some data. Then I go to second Stop and enter some data and so on. When I go to first, second etc. Train stops I use invokeAcrion to call CreateInsert. I need to call only this operation when I press next button. When I press Back button I do not need to call Create Insert action. Hope You understand me.
    So, as I understand, i need to create method which indicates variable value based which button is pressed. But I don't understand how I can say, variable x=nextbuttonpressed or x=backbuttonpressed based on which button I realy press. And do not understand also how to use this variable in invokeAction Refresh Condition?
    Hope You can explain me that with steps to do in my case and can help with code?
    Waiting for response, best regards, Debuger.

  • Ipod mini and a new hard drive

    My old hard drive completely died, and I've had to put a new one in to my computer. I got most of my word documents on to a ZIP disk, but one of the things I was not able to save was my MP3 files. I had a bunch of mp3 files burned from my CDs, as well as a bunch downloaded from itunes and various other sources. They are all still on my ipod mini, but nowhere else. Is there any way that I can get those mp3 files off of my ipod mini and on to my new hard drive? If not, what will happen when I try to update my ipod mini with new mp3s that are on my new hard drive?
    Please advise. I am very scared that I have lost my entire music collection.

    Richard,
    See this.
    Music from iPod to computer.

Maybe you are looking for

  • How to load a text file?

    I'm trying to load a text file and I've run into a wall. So far, I've loaded swf files, image files and XML files without problems. But the text files just don't seem to load. It's not a tough situation. The files are in the same directory as the app

  • Qosmio f60 14q, slow boot

    my laptop has an extremly slow boot time so i downloaded soluto to check if a program is causing it and after multiple tests it takes 4-5 mins till i can use it. so i used the hdd recovery and reinstalled windows 7. and now it takes ~3 mins to boot.

  • Hp PSC 2355 scanner wont work on MacBook Pro!! Please help!!

    I have an Hp PSC 2355 printer, copier and scanner. I can print and copy however i cannot scan anything. Even though i installed the CD, my computer refuses to find the printer. I've tried connecting the USB and then scanning for the USB but it doesnt

  • Updated "Selecting the Best Compiler Options" now available

    The technical article "Selecting the Best Compiler Options" by Darryl Gove has been updated for Sun Studio 12 Update 1 and is now available at: http://developers.sun.com/sunstudio/documentation/techart/compiler_flags/ Here's the abstract: +This artic

  • Flash Lite 1.1 Update Content

    Hi all, i'm very2 new for flash lite. I want to create a flash lite application for nokia 7610 as a completion of my study at my Univ. But i have no idea how to start it. Is it possible a flash lite application can be update. For example a news appli