#Error cells

Hello Friends,
I am struggling #error cells in the report.The below expression is returning #error in the report and i dont understand why ?
=Sum(Fields!X.Value * Fields!Y.Value) / Sum(Fields!Y.Value) / 100   
X and Y is coming as NULL from Database.In this case it should be nothing according to my understanding.

Hi altuko,
According to your description, you have an expression in a cell and it return #Error when rendering. Right?
Generally, if an expression just return #Error, it means this expression has been processed successfully. The expression is correct on logic. Mostly it has issues on the data which is passed into the expression. In this scenario, it doesn't matter if there's
null value in the data fields. As we tested in local environment, the expression will still return result.
One possibility we guess is, the data type for the two data field is not numeric. If you are running report in BI Development Studio Preview, you will get warning messages registered in the VS Output window that explain the details of why
you get #Error.
If you have any question, please feel free to ask.
Best Regards,
Simon Hou

Similar Messages

  • Function to replace division by zero error cells with blank cells when calculating a numeric average

    Hi everyone,
    I have a five sheet spreadsheet that uses data from four sheets to calculate numeric averages in the fifth. The problem is that there is not always data in all four sheets which produces a division by zero error in the averages sheet. Is there a function or setting in Numbers 2.3 (not yet ready to upgrade to Numbers 3) that will allow these division by zero cells to be replaced by blank cells.
    I have tried using statements of the form =AVERAGE(IFERROR(Sheet 1::Table 1:: B4,""),IFERROR(Sheet 2:: Table 1:: B4,""),Sheet 3:: Table 1:: B4,""), Sheet 4:: Table 1:: B4,"")). however instead of a division by zero error this produces an error telling me "the function AVERAGE expects that a number, date or duration but found "." ". It looks as though I will have to make about 400 changes to my sheet as these errors are in this and approximately 100 other cells!
    I am hoping that there is some way if possible of correcting these errors without having to manually edit each cell individually.
    Thanks,
    Hugh

    Hugh,
    You may want to consider an intermediate sheet to handle the errors and then pass the result on to the main sheet.
    In the following mockup, I've created a small interposing table the consists of a list of sources in column A and the result from each table. In the example, I perform some operation on those intermediate results, to be passed on to the main table. This may not be a good example, and since I don't know the overall goal of your project it's just a surrogate. (In real life we probably wouldn't be interested in finding the average of averages.)
    The expression in Summary::B2 is:
    =IFERROR(INDIRECT(A&"::B4"), "SourceError")
    Regards,
    Jerry

  • Hide Error Cell..... please help

    I'm working on a spreadsheet where the data will be inputed each week.
    the problem is, without the value in the field... i'm getting "Can Not Divided By Zero" error in my other fields. Once I put in a value, everything calculates correctly.
    is there a way to hide this error? ignore a field if its empty? It's messing up all my formulas.... please assist

    Jeff,
    Yes there are ways to hide an error message. One good way is to use the IFERROR function.
    For instance, in this case you could write: =IFERROR(A/B, "")
    That expression translates to If A/B generates an error, display (nothing), else display A/B.
    Regards,
    Jerry

  • Random Cell Errors when opening Numbers Document

    I recently downloaded the iWork '09 trial to see if I wanted to upgrade. When I bought iWork '08 I altered the Budget template so I could add my transactions and then have a chart which showed how well I met my budget. (Or how badly I went over)
    When I opened this in the '09 version of Numbers, loads of my cells had turned into the red triangle error thing. Each one saying there was an error in the previous cell. Once I got to the first of these it just said there was an error in that cell. So I dragged the formula from the working cell above down one cell and suddenly loads of these triangle just disappeared. But at another point the triangles started again.
    After ridding myself of these error cells I tried saving the file with a different name as a native '09 file. When I opened it again the error cells were back except they started in different places. After fixing saving and opening I can safely say I have a big problem, each time I reopened the document the error cells started in random places, sometimes in places where they had started previously. I saved it as a Numbers '08 file after fixing it one more time and it opened fine in Numbers '08.
    I am so confused at what is going on. Am I missing something?

    Have you:
    - rebooted your machine?
    - tried opening the same file in another user space?
    - tried removing the preferences for your user to see if they are corrupt?
    To remove preferences:
    1) quit Numbers
    2) open the folder using the Finder menu item "Go > Go to Folder…", then enter the path "~/Library/Preferences/"
    3) move the files:
         com.apple.iWork.Numbers.LSSharedFileList.plist
         com.apple.iWork.Numbers.plist
    4) start Numbers and try to open your file

  • Displaying Custom Error Message in ALV

    Hello Experts,
    Usually, when an error occurs in editable ALV, the standard WD ALV functionality marks the particular error cell in red and displays the error message.
    I want the same functionality for custom error messages in event ON_DATA_CHECK. I'm able to display the message, but looking for a way to mark cells as well.
    Please help....

    Hello friend,
    I think this link will help you much more clear on the coloring of the ALV concepts.
    http://help.sap.com/saphelp_smehp1/helpdata/en/5f/ec57c72a1349c8bfdda56d976e9399/frameset.htm
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393?QuickLink=index&overridelayout=true
    Thanks,
    Sri Hari

  • Error reading Excel file

    Hi,
    I'm trying to read in an XSLX using the XLSDataReader and am having some issues.
    I've narrowed down the issue to 3 adjacent columns in my file and if I map any of these three columns in the reader component, I get an error message:
    >
    ERROR [WatchDog] - Node XLS_GROUPS finished with status: ERROR caused by: Cannot get a text value from a error cell
    ERROR [WatchDog] - Node XLS_GROUPS error details:
    java.lang.IllegalStateException: Cannot get a text value from a error cell
    at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:845)
    at org.apache.poi.xssf.usermodel.XSSFCell.getRichStringCellValue(XSSFCell.java:294)
    at org.apache.poi.xssf.usermodel.XSSFCell.getStringCellValue(XSSFCell.java:246)
    at org.jetel.data.parser.XLSXDataParser.parseNext(XLSXDataParser.java:487)
    at org.jetel.data.parser.XLSParser.getNext(XLSParser.java:132)
    at org.jetel.util.MultiFileReader.getNext(MultiFileReader.java:415)
    at org.jetel.component.XLSReader.execute(XLSReader.java:606)
    at org.jetel.graph.Node.run(Node.java:414)
    at java.lang.Thread.run(Thread.java:619)
    WARN [exNode_0_1306204897681_TRASH0] - TRASH0thread interrupted, it will interrupt child threads
    java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Thread.join(Thread.java:1151)
    at org.jetel.component.Trash.executeWithoutWriter(Trash.java:278)
    at org.jetel.component.Trash.execute(Trash.java:241)
    at org.jetel.graph.Node.run(Node.java:414)
    at java.lang.Thread.run(Thread.java:619)
    ERROR [TRASH0_0.InputThread#0] - 34: thread forcibly aborted
    java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.jetel.graph.DirectEdge.fillReadBuffer(DirectEdge.java:216)
    at org.jetel.graph.DirectEdge.readRecordDirect(DirectEdge.java:182)
    at org.jetel.graph.Edge.readRecordDirect(Edge.java:363)
    at org.jetel.component.Trash$InputReader.run(Trash.java:471)
    >
    I have no idea what an "error cell" is but it's a simple text column in the spreadsheet.
    Any thoughts?
    Thanks in advance!
    Chris

    So I found the culprit.
    One of the cells in the sheet had an actual value of #N/A, but not as a result of a formula.
    Apparently, the XLSDataReader will interpret this as an error value.
    Simply removing the # fixes this and the file is read in without any problems.
    Hope this helps out others.
    Chris

  • Error when updating xml table

    Using IDCS3 I created a master table and exported as xml. Created a working ID file and copied the table over so structure was duplicated with all elements. Deleted some rows I didn't need and made some text changes in the master table.
    According to the manual, when merging the tables, the source should ignore elements that are no longer there and update the text in the remaining cells.
    Tried to update the xml by updating the link but get an error "Cells too small to split".
    I'm new to xml so any advice would be appreciated.
    Regards,
    Gerry

    It appears that ID can't change the cells or rows in a table, although it can change the content. The only solution is to change the table to text and modify the elements that way. The solution removes some flexibility in using tables to manage data.
    Regards,
    Gerry

  • Error while loading data from FDM (EPM 11.1.1.3)

    Hi,
    We are loading data into HFM from FDM. While loading data from FDM it is throwing an error which as below.
    "Load data started: 5/20/2012 9:30:45 PM
    Line 27, Error: Cell for Period Mar is not an input cell.
    Actual,2011,Mar,YTD,ENT_JJ,JPY,A23232323,ENT_J76;[None];[None];[None];ICP_Load;3463437"
    There were multiples lines which are throwing error.
    After doing some checking we found that when we unpost ICP data in HFM we were able to load data from FDM. We have not locked the ICP entities because that will restrcit to load data. But we are not able to understand just unposting the ICP values why we are able to load data from FDM. Also we have not closed the period in HFM.
    Kindly suggest, what could be the possible reason.
    Thanks
    Edited by: user12121146 on May 27, 2012 5:29 AM

    one way to figure this out, would be to open a grad at the same POV.
    It will rule out a couple things.
    If it is locked, you'll visually see that it is locked. (will be grey I believe)
    If it is an invalid intersection, you'll see that as well. (will be red)
    If you do not have access to the cell, you will see that if you look at cell status, it will say NO ACCESS.
    That should help you figure out what is happening, the quick and dirty way.

  • Return to the cell after data validation in JTable

    Hi,
    I am implementing an editable JTable. I want the focus or selection return to the current editing cell when the user inputing a wrong format data. I can catch the validation error and pop up a error message to user. But I can not return the focus or selection to the editing cell.
    If anyone has already solved this problem, please give me your solution.
    Thank you!
    I have tried:
    1.
    In tableChanged(TableModelEvent e) method:
    int row = e.getFirstRow();
    int column = e.getColumn();
    Object data = newJTable.getValueAt(row, column);
    if(!validation(data)) // return true if validation OK
    editFailed = true;//class variable
    previousRow = row;//class variable
    previousCol = column;//class variable
    Add a focus listener to the table and implement the focus listener's focusLost method with:
    if(validationFailed)
    table.editCellAt(previousRow, previousCol);
    This does move the focus to the editing cells if you want to continue to edit the table.
    Problems are
    If you move the focus out of the table, the wrong date will be in the table or not edited.
    The selection color was shown on the next cell where you pointed your mouse to after you leave the editing cells.
    2. I have also tried to use:
    in the above focusLost method
    table.clearSelection();
    table.editCellAt(previousRow, previousCol);
    table.setRowSelectionInterval(previousRow, previousRow);
    table.setColumnSelectionInterval(previousCol, previousRow);
    But it did not change the selection.
    Shaolong

    This is the fix for the above problem.
    Basically we need to handle both mouse/keyboard actions on our own.
    This code returns the control to errorCell..
    /* TableCellValidator class */
    /* The class basically validates the input entry in a cell and */
    /* pops up a JOptionPane if its an invalid input */
    /* And an OK is clicked on the JOptionPane, the control returns back */
    /* to the same cell */
    /* Basic Idea: The controls Arrow/Tab/mouse clicks are handled by our */
    /* ----------- custom table. Its has been slightly tricky to handle */
    /* mouse clicks, since when you click the next cell, the */
    /* editingrow/editingcol advances. Hence the */
    /* previousrow/previouscol has been captured in the */
    /* setValueAt method. */
    /* To capture Table/Arrow/Numeric Arrow, The keyStrokes(TAB etc)*/
    /* assigned different AbstractionActions to execute like */
    /* validateBeforeTabbingToNextCell */
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableCellValidator {
    * Constructor.
    * Basically instantiates the class and sets up the
    * JFrame object and the table.
    public TableCellValidator() {
    JFrame f = new JFrame("JTable test");
    f.getContentPane().add(new JScrollPane(createTable()), "Center");
    f.pack();
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    * A method which created our custom table.
    * The JTable methods processMouseEvent
    * and setValueAt are overridden to handle
    * Mouseclicks.
    * The Tables ActionMap is fed with different
    * AbstractAction classes eg: (validateBeforeTabbingToNextCell)
    * (Scroll down below for the innerclass
    * validateBeforeTabbingToNextCell).
    * So basically when TAB is pressed the stuff present
    * in the validateBeforeTabbingToNextCell's actionPerformed(..)
    * method is performed.
    * So we need to handle all the stuff a TAB does.
    * ie. if a TAB hits the end of the row, we need to increment
    * it to the next Row (if the validation is successful)
    * in the current row etc..
    * @return JTable
    * @see validateBeforeTabbingToNextCell
    * @see validateBeforeShiftTabbingToNextCell
    * @see validateBeforeMovingToNextCell
    * @see validateBeforeMovingDownToCell
    * @see validateBeforeMovingUpToCell
    * @see validateBeforeMovingLeftToCell
    private JTable createTable() {
    JTable table = new JTable(createModel()){
    private int previousRow =0;
    private int previousCol =0;
    * Processes mouse events occurring on this component by
    * dispatching them to any registered
    * <code>MouseListener</code> objects.
    * <p>
    * This method is not called unless mouse events are
    * enabled for this component. Mouse events are enabled
    * when one of the following occurs:
    * <p><ul>
    * <li>A <code>MouseListener</code> object is registered
    * via <code>addMouseListener</code>.
    * </ul>
    * <p>Note that if the event parameter is <code>null</code>
    * the behavior is unspecified and may result in an
    * exception.
    * @param e the mouse event
    * @see java.awt.event.MouseEvent
    * @see java.awt.event.MouseListener
    * @see #addMouseListener
    * @see #enableEvents
    * @since JDK1.1
    protected void processMouseEvent(MouseEvent e) {
    boolean canMoveFocus = true;
    int currentRowAndColumn[] = getCurrentRowAndColumn(this); //we pull the current row and column
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    if ( e.getID() == MouseEvent.MOUSE_PRESSED || e.getID() == MouseEvent.MOUSE_CLICKED) {
    stopCurrentCellBeingEdited(this); //stop the cellbeing edited to grab its value
    final String value = (String)getModel().getValueAt(row,column);
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    SwingUtilities.invokeLater(new Runnable(){
    public void run() {
    JOptionPane.showMessageDialog(null,"Alpha value ="+ value ,"Invalid entry!",JOptionPane.WARNING_MESSAGE);
    changeSelection(previousRow,previousCol, true, true);
    editCellAt(previousRow, previousCol);
    requestFocus(); // or t.getEditorCompo
    if ( canMoveFocus ) {
    super.processMouseEvent(e);
    * The method setValueAt of the JTable is overridden
    * to save the previousRow/previousCol to enable us to
    * get back to the error cell when a Mouse is clicked.
    * This is circumvent the problem, when a mouse is clicked in
    * a different cell, the control goes to that cell and
    * when you ask for getEditingRow , it returns the row that
    * the current mouse click occurred. But we need a way
    * to stop at the previous cell(ie. the cell that we were editing
    * before the mouse click occurred) when an invalid data has
    * been entered and return the focus to that cell
    * @param aValue
    * @param row
    * @param col
    public void setValueAt(Object aValue,int row, int col) {     
    this.previousRow = row;
    this.previousCol = col;
    super.setValueAt(aValue,row,col);
    /* These are the various KeyStrokes like
    ENTER,SHIFT-TAB,TAB,Arrow Keys,Numeric Arrow keys being assigned an Abstract action (key string ) in to the
    inputMap first . Then an Action is assigned in the ActionMap object
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0) ,"validateBeforeTabbingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,1) ,"validateBeforeShiftTabbingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,0) ,"validateBeforeMovingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT,0) ,"validateBeforeMovingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP,0) ,"validateBeforeMovingUpToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP,0) ,"validateBeforeMovingUpToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,0) ,"validateBeforeMovingLeftToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT,0) ,"validateBeforeMovingLeftToCell");
    table.getActionMap().put("validateBeforeTabbingToNextCell",
    new validateBeforeTabbingToNextCell());
    table.getActionMap().put("validateBeforeShiftTabbingToNextCell",
    new validateBeforeShiftTabbingToNextCell());
    table.getActionMap().put("validateBeforeMovingToNextCell",
    new validateBeforeMovingToNextCell());
    table.getActionMap().put("validateBeforeMovingDownToCell",
    new validateBeforeMovingDownToCell());
    table.getActionMap().put("validateBeforeMovingUpToCell",
    new validateBeforeMovingUpToCell());
    table.getActionMap().put("validateBeforeMovingLeftToCell",
    new validateBeforeMovingLeftToCell());
    table.setPreferredScrollableViewportSize(table.getPreferredSize());
    return table;
    * A table model is created here for 5 rows/5 columns.
    * And the isCellEditable is overridden to return true,
    * indicating that the cell can be edited.
    * So fine tuned control can be done here by saying,
    * the user can be allowed to edit Row 1,3 or 5 only.
    * or column 1 only etc..
    * @return DefaultTableModel
    private DefaultTableModel createModel() {
    DefaultTableModel model = new DefaultTableModel(5, 5) {
    public boolean isCellEditable(int row, int column) {
    return true;
    return model;
    * This method basically returns the currentRow/currentCol value
    * If the current Row/Col is being edited then
    * it returns the getEditingRow/getEditingColumn
    * If its not being edited,
    * it return the getAnchorSelectionIndex of the JTables
    * ListSelectionModel.
    * If the column or row is -1, then it return 0.
    * The first element in the int[] array is the row
    * The second element in the int[] array is the column
    * @param t input a JTable
    * @return int[]
    * @see ListSelectionModel
    * @see JTable
    private int[] getCurrentRowAndColumn(JTable t){
    int[] currentRowAndColum = new int[2];
    int row, column;
    if (t.isEditing()) {
    row = t.getEditingRow();
    column = t.getEditingColumn();
    } else {
    row = t.getSelectionModel().getAnchorSelectionIndex();
    if (row == -1) {
    if (t.getRowCount() == 0) {
    //actually this should never happen.. we need to return an exception
    return null;
    column =t.getColumnModel().getSelectionModel().getAnchorSelectionIndex();
    if (column == -1) {
    if (t.getColumnCount() == 0) {
    //actually this should never happen.. we need to return an exception
    return null;
    column = 0;
    currentRowAndColum[0]=row;
    currentRowAndColum[1]=column;
    return currentRowAndColum;
    * Tbis basically a wrapper method for CellEditors,
    * stopCellEditing method.
    * We need to do this because,
    * for instance we have entered a value in Cell[0,0] as 3
    * and when we press TAB or mouse click or any other relevant
    * navigation keys,
    * ** IF the cell is BEING EDITED,
    * when we do a getValueAt(cellrow,cellcol) at the TableModel
    * level , it would return "null". To overcome this problem,
    * we tell the cellEditor to stop what its doing. and then
    * when you do a getValueAt[cellrow,cellcol] it would
    * return us the current cells value
    * @param t Input a JTable
    * @see CellEditor
    private void stopCurrentCellBeingEdited(JTable t){
    CellEditor ce = t.getCellEditor(); /*this not the ideal way to do..
    since there is no way the CellEditor could be null.
    But a nullpointer arises when trying to work with mouse.. rather than just
    keyboard" */
    if (ce!=null) {
    ce.stopCellEditing();
    * The following Action class handles when a
    * RIGHT ARROW or NUMERIC RIGHT ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to the
    * next Cell.. else take it back to the currentCell
    class validateBeforeMovingToNextCell extends AbstractAction {
    * The following Action class handles when a
    * DOWN ARROW or NUMERIC DOWN ARROW is pressed.
    * There is just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to
    * down by one Cell.. else take it back to the currentCell
    * @param e
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column++;
    if (column >= t.getColumnCount())
    column = column-1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * DOWN ARROW or NUMERIC DOWN ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to the
    * down by Cell.. else take it back to the currentCell
    class validateBeforeMovingDownToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    row++;
    if (row >= t.getRowCount())
    row = row - 1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * UP ARROW or NUMERIC UP ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeMovingUpToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    row--;
    if (row <0)
    row = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * LEFT ARROW or NUMERIC LEFT ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeMovingLeftToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column--;
    if (column <0)
    column = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a TAB is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeTabbingToNextCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column++;
    int rows = t.getRowCount(), columns = t.getColumnCount();
    while (row < rows) {
    while (column < columns) {
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    column++;
    row++;
    column = 0;
    row = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a SHIFT TAB is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeShiftTabbingToNextCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column--;
    int rows = t.getRowCount(), columns = t.getColumnCount();
    while ((row < rows) && (row >= 0)) {
    while ((column < columns) && (column >= 0)) {
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    column--;
    row--;
    column = columns - 1;
    row = rows - 1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    public static void main(String[] args) {
    new TableCellValidator();

  • How to load data into read only cells in HFM?

    Can any one help me in loading data into Read only cells in HFM?. I am trying to lad data into a read only cell using data load file and i m getting the below error.
    NB: I need the "UseLineItem Details" to be enabled.I shud be able to submit the data thoudh the "UseLineItem Details" property of the account member is enabled
    Data load File
    !Column_Order = Scenario, Year, Period, View, Entity, Value, Account, ICP, Custom1, Custom2, Custom3, Custom4
    !DATA
    Actual; 2013; January; Periodic; NZ; NZD; 141100; [ICP None]; [None]; [None]; [None]; [None]; 10000
    Error Received
    Line: 4, Error: Cell for Period January is not an input cell.
    Actual; 2013; January; Periodic; NZ; NZD; 141100; [ICP None]; [None]; [None]; [None]; [None]; 10000
    >>>>>>
    Can any one please help me ....

    Hi,
    Example: Assume that you have Travel Account#141100
    Now you have below information
    Travel Expenses $30,000
    Food Expenses $50,000
    Hotel expenses$20,000
    To enter this details normally you will create additional 3 accounts(1.TravelExpenses 2.FoodExpenses 3.HotelExpenses) under Travel Account#141100
    Using lineItem Details No need to create additional accounts. you can show the detailed information in a single cell(Single Account).
    To do this
    1.Create a New datagrid in workspace
    2.Right-click and select Cell Line Item Detail on Account#141100 (which is enabled line item details)
    3.Click on add button then provide the description and Enter the amount then press enter.
    1)Travel Expenses $30,000
    2)Food Expenses $50,000
    3)Hotel expenses$20,000
    4.Total $100,000 will be shown in Account#141100
    (If you want to see the detailed information just Right-click and select Cell Line Item Detail on Account#141100)
    To get clear understanding please go through the HFM Admin guide.
    Regards
    Sarilla

  • Programmatically selecting a cell in a two-dimensional JTable

    The problem is that when a person edits a cell and the value fails validation, I would like to programmatically select the cell. The validation is done in the setValueAt method of a Class extending the AbstractTableModel. By simply returning out of that method, the cell value is set back to the way it was before the user changed it. In addition, I would like the problem cell to be automatically selected rather than requiring the user to click in it to select it. The first question is 1- Is this possible, and 2- Any clues as to how to select it?
    We find for examle in Chapter 6 of the CoreJava 2 Vol II Advanced features statements like this on page 399 of, I think, Edition 4, (can anyone tell what edition it is?) by Cay Horstmann
    void setCellSelectionEnabled(boolean b)
    If b is true, then individual cells are selected (when the user clicks in the cell?). I have researched this problem for several days and don't have a clue how to automatically select the cell although I know precisely what row and column it is.

    This is the code to return the focus to error cell.
    /* TableCellValidator class */
    /* The class basically validates the input entry in a cell and */
    /* pops up a JOptionPane if its an invalid input */
    /* And an OK is clicked on the JOptionPane, the control returns back */
    /* to the same cell */
    /* Basic Idea: The controls Arrow/Tab/mouse clicks are handled by our */
    /* ----------- custom table. Its has been slightly tricky to handle */
    /* mouse clicks, since when you click the next cell, the */
    /* editingrow/editingcol advances. Hence the */
    /* previousrow/previouscol has been captured in the */
    /* setValueAt method. */
    /* To capture Table/Arrow/Numeric Arrow, The keyStrokes(TAB etc)*/
    /* assigned different AbstractionActions to execute like */
    /* validateBeforeTabbingToNextCell */
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableCellValidator {
    * Constructor.
    * Basically instantiates the class and sets up the
    * JFrame object and the table.
    public TableCellValidator() {
    JFrame f = new JFrame("JTable test");
    f.getContentPane().add(new JScrollPane(createTable()), "Center");
    f.pack();
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    * A method which created our custom table.
    * The JTable methods processMouseEvent
    * and setValueAt are overridden to handle
    * Mouseclicks.
    * The Tables ActionMap is fed with different
    * AbstractAction classes eg: (validateBeforeTabbingToNextCell)
    * (Scroll down below for the innerclass
    * validateBeforeTabbingToNextCell).
    * So basically when TAB is pressed the stuff present
    * in the validateBeforeTabbingToNextCell's actionPerformed(..)
    * method is performed.
    * So we need to handle all the stuff a TAB does.
    * ie. if a TAB hits the end of the row, we need to increment
    * it to the next Row (if the validation is successful)
    * in the current row etc..
    * @return JTable
    * @see validateBeforeTabbingToNextCell
    * @see validateBeforeShiftTabbingToNextCell
    * @see validateBeforeMovingToNextCell
    * @see validateBeforeMovingDownToCell
    * @see validateBeforeMovingUpToCell
    * @see validateBeforeMovingLeftToCell
    private JTable createTable() {
    JTable table = new JTable(createModel()){
    private int previousRow =0;
    private int previousCol =0;
    * Processes mouse events occurring on this component by
    * dispatching them to any registered
    * <code>MouseListener</code> objects.
    * <p>
    * This method is not called unless mouse events are
    * enabled for this component. Mouse events are enabled
    * when one of the following occurs:
    * <p><ul>
    * <li>A <code>MouseListener</code> object is registered
    * via <code>addMouseListener</code>.
    * </ul>
    * <p>Note that if the event parameter is <code>null</code>
    * the behavior is unspecified and may result in an
    * exception.
    * @param e the mouse event
    * @see java.awt.event.MouseEvent
    * @see java.awt.event.MouseListener
    * @see #addMouseListener
    * @see #enableEvents
    * @since JDK1.1
    protected void processMouseEvent(MouseEvent e) {
    boolean canMoveFocus = true;
    int currentRowAndColumn[] = getCurrentRowAndColumn(this); //we pull the current row and column
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    if ( e.getID() == MouseEvent.MOUSE_PRESSED || e.getID() == MouseEvent.MOUSE_CLICKED) {
    stopCurrentCellBeingEdited(this); //stop the cellbeing edited to grab its value
    final String value = (String)getModel().getValueAt(row,column);
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    SwingUtilities.invokeLater(new Runnable(){
    public void run() {
    JOptionPane.showMessageDialog(null,"Alpha value ="+ value ,"Invalid entry!",JOptionPane.WARNING_MESSAGE);
    changeSelection(previousRow,previousCol, true, true);
    editCellAt(previousRow, previousCol);
    requestFocus(); // or t.getEditorCompo
    if ( canMoveFocus ) {
    super.processMouseEvent(e);
    * The method setValueAt of the JTable is overridden
    * to save the previousRow/previousCol to enable us to
    * get back to the error cell when a Mouse is clicked.
    * This is circumvent the problem, when a mouse is clicked in
    * a different cell, the control goes to that cell and
    * when you ask for getEditingRow , it returns the row that
    * the current mouse click occurred. But we need a way
    * to stop at the previous cell(ie. the cell that we were editing
    * before the mouse click occurred) when an invalid data has
    * been entered and return the focus to that cell
    * @param aValue
    * @param row
    * @param col
    public void setValueAt(Object aValue,int row, int col) {     
    this.previousRow = row;
    this.previousCol = col;
    super.setValueAt(aValue,row,col);
    /* These are the various KeyStrokes like
    ENTER,SHIFT-TAB,TAB,Arrow Keys,Numeric Arrow keys being assigned an Abstract action (key string ) in to the
    inputMap first . Then an Action is assigned in the ActionMap object
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0) ,"validateBeforeTabbingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,1) ,"validateBeforeShiftTabbingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,0) ,"validateBeforeMovingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT,0) ,"validateBeforeMovingToNextCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0) ,"validateBeforeMovingDownToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP,0) ,"validateBeforeMovingUpToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP,0) ,"validateBeforeMovingUpToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,0) ,"validateBeforeMovingLeftToCell");
    table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT,0) ,"validateBeforeMovingLeftToCell");
    table.getActionMap().put("validateBeforeTabbingToNextCell",
    new validateBeforeTabbingToNextCell());
    table.getActionMap().put("validateBeforeShiftTabbingToNextCell",
    new validateBeforeShiftTabbingToNextCell());
    table.getActionMap().put("validateBeforeMovingToNextCell",
    new validateBeforeMovingToNextCell());
    table.getActionMap().put("validateBeforeMovingDownToCell",
    new validateBeforeMovingDownToCell());
    table.getActionMap().put("validateBeforeMovingUpToCell",
    new validateBeforeMovingUpToCell());
    table.getActionMap().put("validateBeforeMovingLeftToCell",
    new validateBeforeMovingLeftToCell());
    table.setPreferredScrollableViewportSize(table.getPreferredSize());
    return table;
    * A table model is created here for 5 rows/5 columns.
    * And the isCellEditable is overridden to return true,
    * indicating that the cell can be edited.
    * So fine tuned control can be done here by saying,
    * the user can be allowed to edit Row 1,3 or 5 only.
    * or column 1 only etc..
    * @return DefaultTableModel
    private DefaultTableModel createModel() {
    DefaultTableModel model = new DefaultTableModel(5, 5) {
    public boolean isCellEditable(int row, int column) {
    return true;
    return model;
    * This method basically returns the currentRow/currentCol value
    * If the current Row/Col is being edited then
    * it returns the getEditingRow/getEditingColumn
    * If its not being edited,
    * it return the getAnchorSelectionIndex of the JTables
    * ListSelectionModel.
    * If the column or row is -1, then it return 0.
    * The first element in the int[] array is the row
    * The second element in the int[] array is the column
    * @param t input a JTable
    * @return int[]
    * @see ListSelectionModel
    * @see JTable
    private int[] getCurrentRowAndColumn(JTable t){
    int[] currentRowAndColum = new int[2];
    int row, column;
    if (t.isEditing()) {
    row = t.getEditingRow();
    column = t.getEditingColumn();
    } else {
    row = t.getSelectionModel().getAnchorSelectionIndex();
    if (row == -1) {
    if (t.getRowCount() == 0) {
    //actually this should never happen.. we need to return an exception
    return null;
    column =t.getColumnModel().getSelectionModel().getAnchorSelectionIndex();
    if (column == -1) {
    if (t.getColumnCount() == 0) {
    //actually this should never happen.. we need to return an exception
    return null;
    column = 0;
    currentRowAndColum[0]=row;
    currentRowAndColum[1]=column;
    return currentRowAndColum;
    * Tbis basically a wrapper method for CellEditors,
    * stopCellEditing method.
    * We need to do this because,
    * for instance we have entered a value in Cell[0,0] as 3
    * and when we press TAB or mouse click or any other relevant
    * navigation keys,
    * ** IF the cell is BEING EDITED,
    * when we do a getValueAt(cellrow,cellcol) at the TableModel
    * level , it would return "null". To overcome this problem,
    * we tell the cellEditor to stop what its doing. and then
    * when you do a getValueAt[cellrow,cellcol] it would
    * return us the current cells value
    * @param t Input a JTable
    * @see CellEditor
    private void stopCurrentCellBeingEdited(JTable t){
    CellEditor ce = t.getCellEditor(); /*this not the ideal way to do..
    since there is no way the CellEditor could be null.
    But a nullpointer arises when trying to work with mouse.. rather than just
    keyboard" */
    if (ce!=null) {
    ce.stopCellEditing();
    * The following Action class handles when a
    * RIGHT ARROW or NUMERIC RIGHT ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to the
    * next Cell.. else take it back to the currentCell
    class validateBeforeMovingToNextCell extends AbstractAction {
    * The following Action class handles when a
    * DOWN ARROW or NUMERIC DOWN ARROW is pressed.
    * There is just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to
    * down by one Cell.. else take it back to the currentCell
    * @param e
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column++;
    if (column >= t.getColumnCount())
    column = column-1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * DOWN ARROW or NUMERIC DOWN ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move it to the
    * down by Cell.. else take it back to the currentCell
    class validateBeforeMovingDownToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    row++;
    if (row >= t.getRowCount())
    row = row - 1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * UP ARROW or NUMERIC UP ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeMovingUpToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    row--;
    if (row <0)
    row = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a
    * LEFT ARROW or NUMERIC LEFT ARROW is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeMovingLeftToCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column--;
    if (column <0)
    column = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a TAB is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeTabbingToNextCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column++;
    int rows = t.getRowCount(), columns = t.getColumnCount();
    while (row < rows) {
    while (column < columns) {
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    column++;
    row++;
    column = 0;
    row = 0;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    * The following Action class handles when a SHIFT TAB is pressed.
    * There just a basic checking for Numeric values
    * (Integer.parseInt) inside the code.
    * When validation is successfull, we need to move the cursor/
    * editable status up by a Cell.. else take it back to the currentCell
    class validateBeforeShiftTabbingToNextCell extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
    JTable t = (JTable) e.getSource();
    int currentRowAndColumn[] = getCurrentRowAndColumn(t);
    int row = currentRowAndColumn[0];
    int column = currentRowAndColumn[1];
    stopCurrentCellBeingEdited(t);
    String value = (String)t.getModel().getValueAt(row,column);
    if (value!= null && !value.equals("")) {
    try {
    Integer.parseInt(value);
    } catch (NumberFormatException nfe) {
    JOptionPane.showMessageDialog(null,"Please input numeric values at cell[row="+row+","+"col="+column+"]","Invalid Input!!",JOptionPane.WARNING_MESSAGE);
    t.changeSelection(row, column, true, true);
    t.editCellAt(row,column);
    t.getEditorComponent().requestFocus();
    return;
    column--;
    int rows = t.getRowCount(), columns = t.getColumnCount();
    while ((row < rows) && (row >= 0)) {
    while ((column < columns) && (column >= 0)) {
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    column--;
    row--;
    column = columns - 1;
    row = rows - 1;
    if (t.isCellEditable(row, column)) {
    t.changeSelection(row, column, true, true);
    t.editCellAt(row, column);
    if ((t.getEditingRow() == row)
    && (t.getEditingColumn() == column)) {
    t.requestFocus();
    return;
    public static void main(String[] args) {
    new TableCellValidator();

  • Reporting one message-text for several errors

    hy,
    I have a table binded to context. The table hase several rows and columns. The user can edit the values in table-cells. Now I want to make a plausibility-check for all values in the table. And if there are for example 5 errors I want to mark the error-cells red. Therefore I wrote
    msgMgr.reportContextAttributeMessage(
            element,
         attrinfo,
         IMessageZABComp.TEST,
         new Object[] ,
         false
    for every error-field. My problem is that there are 5 error-messages shown in the message-area, but I want to show only one error-message "please correct your input !". How can I do this ? How can I put out only one message in the message-area, though there are several errors ?
    Florian

    hi florian ,
    can you elaborate on the situation. if you define any message inside the message pool and display it using
    Msgmngr.reportcontextattributeMessage(elemnt,attributeinfo,IMessage<compname>.test,new Object [] ,false) , it'll only display the error message with id 'test' only once. just check if you are writing this code inside a loop.
    regards,
    rahul.

  • ALV Grid: Problem with errors

    Hi,
      Many of you must have definitely experienced this problem.
    I have some default rows on ALV screen for user to enter data.
    Say field1, field2 are in the fields list. Now if user puts values in field2, I consider that as a change and I validate entire row. Say field1 is mandatory. I show an error on field1 when field2 has been changed by adding protocol entry.
    Now if user changes different row and presses enter, mod_cells does not contain entries related to field1 for first row even though protocol contains errors for field1 on first row. Because of this, first row is not getting validated again.
    I added adding an entry in mod_cells for field1. It does not seem to work.
    Please let me know if you have any solution for this problem.
    Thanks.
    Srinivas.

    Hi Aaron,
    set_selected_cells or so is the method. then user is positioned at the error cell.
    regards,
    Clemens

  • Error validation

    i have a registration form set up, and have validation for it, basically if the fields are blank.  when i submit with the fields filled, it says "There were some error processing your form: Please review the following fields:" but there are no fields after that listed.  also, when i leave one required field blank, it gives me the same message.
    if(array_key_exists('submit',$_POST))
    $FName = $_POST['FName'];
    if(empty($FName))
        $error['FName'] = 'Flagged';
    $LName = trim($_POST['LName']);
    if(empty($LName))
        $error['LName'] = 'Flagged';
    $name = trim($_POST['phone']);
    if(empty($phone))
        $error['phone'] = 'Flagged';
    $cell = trim($_POST['cell']);
    if(empty($cell))
        $error['cell'] = 'Flagged';
    $streetaddress = trim($_POST['streetaddress']);
    if(empty($streetaddress))
        $error['streetaddress'] = 'Flagged';
    $state = trim($_POST['state']);
    if($state=="Please Select")
        $error['state'] = 'Flagged';
    $zip = trim($_POST['zip']);
    if(empty($zip))
        $error['zip'] = 'Flagged';
    $email = $_POST['email'];
    $pattern = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
    if (!preg_match($pattern, trim($email)))
        $error['email'] = 'Flagged';
    <?     $reqfields = array('FName','LName', 'phone','cell', 'address', 'state', 'zip','email');
         $reqfieldnames = array('First name','Last name','Phone Number','Cell  Phone Number','Address','State','Zip Code','E-mail address');
    if (isset($_POST['submit'])) {
        if (isset($error)) {
            echo '<div class="error"><img src="../Images/error_icon.png" width="30" height="27" /> <span class="bolderror">There were some error processing your form: Please review the following fields:</span> <br><br>';
        for ($i=0; $i<sizeof($reqfields); $i++) {
            if ($error[$reqfields[$i]] == 'Flagged') {
                echo $reqfieldnames[$i] . "<br>";
        echo "</div>";
    if (!isset($error))
    // send form...
    ?>
    thanks!

    future-architect wrote:
    $streetaddress = trim($_POST['streetaddress']);
    if(empty($streetaddress))
        $error['streetaddress'] = 'Flagged';
    Your $reqfields array doesn't contain streetaddress. It uses address instead. That's what's causing the problem. You would be able to detect this type of issue yourself if you configured PHP to display notices in addition to other error messages.

  • Problem while tabbing out of a cell

    I have a JTable in which if I enter an invalid data in a particular cell and tab out, after showing the error message the cursor should be brought back to the error cell. I was able to do this with the following code.
    isCellEditable(int row, int col){
    tblDamageDetials.changeSelection(errorRow,errorCol,false,false);
    tblDamageDetials.setEditingColumn(errorCol);
    errorRow and errorCol will have the row and col where the invalid data is present.
    This will act like a lock and will never let u out of the error cell if u tab again. But I want the error message to appear everytime I tab out of the error cell.
    The code to display the error message is invoked from the method setValueAt().
    But the problem is when I try to tab out of the cell again, I'll not be getting the error message again.This is because the setValueAt method will be called only if the cursor is on the celleditor. But the above code will not put the cursor on the editor, instead it will be on the renderer only. So while tabbing the setValueAt will not be invoked.
    I tried bringing the focus to the editor by using tblDamageDetials.editCellAt(erroRow,errorCol);
    Then I am getting StackOverFlow error.
    Could somebody please help me out.

    Thanks for the help.I tried implementing what u told, but still I'm getting StackOverflow exception.I'm getting the exception at editCellAt() method.
    I'll paste my code here.If possible please look into it.
    import javax.swing.*;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.DefaultCellEditor;
    import java.awt.*;
    public class TestTable extends JFrame {
    public static final int firstCol = 0;
    public static final int secondCol = 1;
    public Object[][] tableData = {{"", ""}, {"", ""}};
    public String[] colName = {"First Col", "Second Col"};
    public TableModel tableModel = new TableModel();
    public JTable tblDamageDetials = new JTable(tableModel);
    public int rowSelected = 0;
    private JScrollPane slpDemageDetails = null;
    private JTextField txfDamageComponent = new JTextField();
    private JTextField txfRepair = new JTextField();
    private boolean checkFlag = true;
    private int errorCol = -1;
    private int errorRow = -1;
    MyCellEditor myCellEditor = null;
    TestTable() {
    this.getContentPane().setLayout(new BorderLayout());
    this.getContentPane().add(getslpDemageDetails(), BorderLayout.CENTER);
    private JScrollPane getslpDemageDetails() {
    if (slpDemageDetails == null) {
    createTable();
    return slpDemageDetails;
    public static void main(String args[]) {
    TestTable test = new TestTable();
    test.show();
              test.setVisible(true);
    test.setSize(800, 500);
    class TableModel extends AbstractTableModel {
    public int getColumnCount() {
    return colName.length;
    public int getRowCount() {
    return colName.length;
    public String getColumnName(int col) {
    return colName[col];
    public Object getValueAt(int row, int col) {
    return tableData[row][col];
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    public boolean isCellEditable(int row, int col) {
    if ((errorCol != -1) && (errorRow != -1)) {
    tblDamageDetials.editCellAt(errorRow, errorCol);
    checkFlag = true;
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    myCellEditor = null;
    myCellEditor = (MyCellEditor) tblDamageDetials.getCellEditor(errorRow, errorCol);
    myCellEditor.getTextField().requestFocus();
    return true;
    public void setValueAt(Object value, int row, int col) {
    if (value == null) {
    return;
    tableData[row][col] = value.toString();
    if (col == firstCol) {
    if (checkFlag) {
    checkFlag = validateData();
    if (checkFlag) {
    errorCol = -1;
    errorRow = -1;
    fireTableCellUpdated(row, col);
    public void createTable() {
    tblDamageDetials.getTableHeader().setReorderingAllowed(false);
    tblDamageDetials.setBackground(Color.white);
    tblDamageDetials.setSelectionBackground(new Color(254, 254, 254));
    tblDamageDetials.setRowHeight(20);
    JTableHeader header = tblDamageDetials.getTableHeader();
    Dimension dim = header.getPreferredSize();
    dim.height = 40;
    header.setPreferredSize(dim);
    tblDamageDetials.getColumnModel().getColumn(firstCol).setCellEditor(new MyCellEditor(txfDamageComponent));
    tblDamageDetials.getColumnModel().getColumn(secondCol).setCellEditor(new MyCellEditor(txfRepair));
    ListSelectionModel rowSM = tblDamageDetials.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel) e.getSource();
    if (lsm.isSelectionEmpty()) {
    rowSelected = -1;
    return;
    } else
    rowSelected = lsm.getMinSelectionIndex();
    slpDemageDetails = new JScrollPane(tblDamageDetials);
    slpDemageDetails.setName("slpDemageDetails");
    dim = new Dimension(454, 500);
    slpDemageDetails.setPreferredSize(dim);
    slpDemageDetails.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    slpDemageDetails.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    } /* End of createTable method */
    private boolean validateData() {
    boolean checkFlag = true;
    int size = tblDamageDetials.getRowCount();
    for (int i = 0; i < size; i++) {
    if ((checkFlag) && (getParseFloat(tableData[i][firstCol].toString().trim()) == 0)) {
    JOptionPane.showMessageDialog(null, "invalid data");
    checkFlag = false;
    errorCol = firstCol;
    errorRow = i;
    return checkFlag;
    public float getParseFloat(String value) {
    float retValue = 0.0f;
    try {
    retValue = Float.parseFloat(value);
    } catch (NumberFormatException e) {
    retValue = 0.0f;
    return retValue;
    } /* End of getParseFloat method */
    class MyCellEditor extends DefaultCellEditor {
    private JTextField tf;
    public MyCellEditor(JTextField text) {
    super(text);
    tf = (JTextField) editorComponent;
    public JTextField getTextField() {
    return tf;
    Hope somebody will be able to help me.
    Thanks,
    Ashey

Maybe you are looking for

  • Reg:Indexing

    Hi, Can anyone please tell help me out from this issue.My issue is i developed a custom transaction but in that the select query from a standard table is taking more time (18min) and that table contains 23lakhs records.Then how could i improve the pe

  • Retrieve data from AD from within a custom sharepoint 2010 webpart

    Hi, I have a requirement to retrieve user data from AD and display from within a custom built webpart. I am using the PrincipalContext class etc to get the info from AD, i have sucesfully done this in a console program without having to specifiy a us

  • Iphoto events show no photos

    Lately, when I double - clicked "Events" of each folder, I saw no photos inside the window; only saw "No Photos" on the top right corner.  I have tried rebuilding thumbnails and data.  No luck.  The fact is when I clicked "Photos", or albums, all pho

  • 2 player turn based game logic in c# for snake and ladder

    Hello programmers, I am developing a snake and ladder game in xaml and C#.(windows 8.1 app) my question is: 1) I am unable to think about the solution for player turn, I have build the game logic for single player and its working fine. please provide

  • Opening Stock + InwardQty + OutwardQty + Price_ OINM

    Hi Members, I need an SQL query for the " Stock Statement " From OINM Table to display opening stock , InwardQty as 'Receipts', OutwardQty as 'Issue', Price using Date and WareHouse as selection criteria. Kindly Help me in this regard, Thanks and Reg