QuerySetCell adding row data

I'm using querysetcell to display data from an sql query.  the trouble i'm having is not being able to add the numbers in a row. 
c1     c2    c3          c4         c5      c6     c7   Total ?
849
7
10,323
1,992
1,809
0
195
0
<cfset querySetCell(qPivot, 'dept_' & tmpDeptCode, numCredits)>  This gets me number portion above.  How do I get them to add into one number?

THis is the code
<cfparam name="Levels" default="U1,U2,U3,U4">
  <!--- Get Unique Departments --->
  <cfquery dbtype="query" name="qCourseDepts">
      SELECT DISTINCT ('dept_' + scbcrse_dept_code) as scbcrse_dept_code
      FROM   qCredits
      ORDER BY scbcrse_dept_code
  </cfquery>
  <!---Make Column List and Convert to Alphanumeric Characters --->
  <cfset txtColumnList = "Level, CollegeCode, DeptCode, " & valueList(qCourseDepts.scbcrse_dept_code) & ", GrandTotal">
  <cfset txtColumnList = replace(txtColumnList, "-", "_", "ALL")>
  <cfset txtColumnList = replace(txtColumnList, "&", "_", "ALL")>
  <!--- Build New Table --->
  <cfset qPivot = queryNew(txtColumnList)>
  <cfloop query="qCredits">
   <cfset tmpCreditCount = 0>
    <!--- Build New Row --->
   <cfif qCredits.sgbstdn_levl_code NEQ qCredits.sgbstdn_levl_code[currentRow-1] OR qCredits.sgbstdn_coll_code_1
                                                      NEQ qCredits.sgbstdn_coll_code_1[currentRow-1] OR qCredits.sgbstdn_dept_code
                                                      NEQ qCredits.sgbstdn_dept_code[CurrentRow-1]>
  <cfset queryAddRow(qPivot)>
      <cfset querySetCell(qPivot, "Level", qCredits.sgbstdn_levl_code)>
      <cfset querySetCell(qPivot, "CollegeCode", qCredits.sgbstdn_coll_code_1)>
      <cfset querySetCell(qPivot, "DeptCode", qCredits.sgbstdn_dept_code)>
   </cfif>
   <cfset tmpDeptCode = replace(scbcrse_dept_code, "&", "_", "ALL")>
   <cfset tmpDeptCode = replace(tmpDeptCode, "-", "_", "ALL")>
   <cfset querySetCell(qPivot, 'dept_' & tmpDeptCode, numCredits)>
   <cfif ((qPivot.currentRow gt 1) && (qPivot.value neq qPivot.level[qPivot.currentRow - 1 ]))>
    <cfset querySetCell(qPivot, "GrandTotal", dept_UBS[qPivot.currentRow] + dept_FEDU[qPivot.currentRow]
                                                +dept_B_UG[qPivot.currentRow] + dept_UHMN[qPivot.currentRow]
                                                +dept_UM_T[qPivot.currentRow] + dept_LAW[qPivot.currentRow]
                                                +dept_UPVA[qPivot.currentRow, numCredits])> 
   </cfif>
  </cfloop>
Output looks like this;
Level
College
Dept
c1
c2
c3
c4
c5
c6
c7
Grand
Total
U1
SB
B-UG
849
7
10,323
1,992
1,809
0
195
0
UG
UBS
6,282
10
282
1,036
1,567
0
223
0
UG
UHMN
1,296
26
492
3,955
1,396
0
409
0
UG
UM&T
4,473
33
984
5,288
25,484
0
690
0
UG
UPVA
141
11
99
282
244
0
910
0
U2
SB
B-UG
483
15
7,491
870
1,019
0
51
0
UG
UBS
7,410
36
219
1,062
1,750
15
170
0
UG
UHMN
933
57
186
2,097
1,539
0
184
0
UG
UM&T
318
0
117
507
3,228
0
89
0
UG
UPVA
81
3
72
102
160
0
455
0
U3
SB
B-UG
567
45
7,383
1,311
1,392
0
64
0
U4
UG
UBS
1,182
9
48
156
281
0
27
0
UG
UHMN
15
6
0
15
15
0
3
0
UG
UM&T
3
0
9
0
107
0
0
0
Grand Total
24,033
258
27,705
18,673
39,991
15
3,470
114,145

Similar Messages

  • Reading the Data from dynamically added rows of a table...

    Hi,
                  I am using adobe interactive form (WD ABAP) in which i am adding the table rows dynamically (using Jscript code).  I have to fech these data into an internal table. But I can read only the first row data..
                  Also While adding rows dynamically the same data is repeating for the consecutive rows..
                  I have found many similar posts in sdn, but i cannot get the solution. They have mentioned about adding in WDDOINIT method. Can anyone explain me what should be done,..?
    1) How to solve repeatative data while adding rows..?
    2) How to read dynamically added row data during runtime into internal table..?
    Thanks,
    Surya.

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • Add null rows in WDDOINIT  for fetching data from dynamically added rows..

    Hi,,
    I have to fetch data from a dynamically added rows of a table.
    I have followed / gone through many forums but they ddnot mention how to add null rows in the initialization method..
    I am using WD Abap..
    Can anyone help how to bind null rows in WDDOINIT method..?
    Thanks,
    Surya

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • TableSorter errors when adding new data

    so here is the deal:
    I am using the TableSorter.java helper class with DefaultTableModel
    from: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    It works great when the data is static and I get it for the first time. however, occationally, when adding new data I get a NullPointerException error.
    in use:
    DefaultTableModel.addRow()
    DefaultTableModel.removeRow() and
    DefaultTableModel.insertRow() methods.
    Error:
    java.lang.ArrayIndexOutOfBoundsException: 5
         at com.shared.model.TableSorter.modelIndex(TableSorter.java:294)
         at com.shared.model.TableSorter.getValueAt(TableSorter.java:340)
         at javax.swing.JTable.getValueAt(Unknown Source)
         at javax.swing.JTable.prepareRenderer(Unknown Source)...
    code problem I:
        public Object getValueAt(int row, int column)
            return tableModel.getValueAt(modelIndex(row), column);
        }code problem II:
        public int modelIndex(int viewIndex)
                 return getViewToModel()[viewIndex].modelIndex;     
        }TableSroter class:
    package com.shared.model;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.*;
    * TableSorter is a decorator for TableModels; adding sorting
    * functionality to a supplied TableModel. TableSorter does
    * not store or copy the data in its TableModel; instead it maintains
    * a map from the row indexes of the view to the row indexes of the
    * model. As requests are made of the sorter (like getValueAt(row, col))
    * they are passed to the underlying model after the row numbers
    * have been translated via the internal mapping array. This way,
    * the TableSorter appears to hold another copy of the table
    * with the rows in a different order.
    * <p/>
    * TableSorter registers itself as a listener to the underlying model,
    * just as the JTable itself would. Events recieved from the model
    * are examined, sometimes manipulated (typically widened), and then
    * passed on to the TableSorter's listeners (typically the JTable).
    * If a change to the model has invalidated the order of TableSorter's
    * rows, a note of this is made and the sorter will resort the
    * rows the next time a value is requested.
    * <p/>
    * When the tableHeader property is set, either by using the
    * setTableHeader() method or the two argument constructor, the
    * table header may be used as a complete UI for TableSorter.
    * The default renderer of the tableHeader is decorated with a renderer
    * that indicates the sorting status of each column. In addition,
    * a mouse listener is installed with the following behavior:
    * <ul>
    * <li>
    * Mouse-click: Clears the sorting status of all other columns
    * and advances the sorting status of that column through three
    * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to
    * NOT_SORTED again).
    * <li>
    * SHIFT-mouse-click: Clears the sorting status of all other columns
    * and cycles the sorting status of the column through the same
    * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
    * <li>
    * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except
    * that the changes to the column do not cancel the statuses of columns
    * that are already sorting - giving a way to initiate a compound
    * sort.
    * </ul>
    * <p/>
    * This is a long overdue rewrite of a class of the same name that
    * first appeared in the swing table demos in 1997.
    * @author Philip Milne
    * @author Brendon McLean
    * @author Dan van Enckevort
    * @author Parwinder Sekhon
    * @version 2.0 02/27/04
    public class TableSorter extends AbstractTableModel
        protected TableModel tableModel;
        public static final int DESCENDING = -1;
        public static final int NOT_SORTED = 0;
        public static final int ASCENDING = 1;
        private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
        public static final Comparator COMPARABLE_COMAPRATOR = new Comparator()
            public int compare(Object o1, Object o2)
                return ((Comparable) o1).compareTo(o2);
        public static final Comparator LEXICAL_COMPARATOR = new Comparator()
            public int compare(Object o1, Object o2)
                return o1.toString().compareTo(o2.toString());
        private Row[] viewToModel;
        private int[] modelToView;
        private JTableHeader tableHeader;
        private MouseListener mouseListener;
        private TableModelListener tableModelListener;
        private Map columnComparators = new HashMap();
        private List sortingColumns = new ArrayList();
        public TableSorter()
            this.mouseListener = new MouseHandler();
            this.tableModelListener = new TableModelHandler();
        public TableSorter(TableModel tableModel)
            this();
            setTableModel(tableModel);
        public TableSorter(TableModel tableModel, JTableHeader tableHeader)
            this();
            setTableHeader(tableHeader);
            setTableModel(tableModel);
        private void clearSortingState()
            viewToModel = null;
            modelToView = null;
        public TableModel getTableModel()
            return tableModel;
        public void setTableModel(TableModel tableModel)
            if (this.tableModel != null)
                this.tableModel.removeTableModelListener(tableModelListener);
            this.tableModel = tableModel;
            if (this.tableModel != null)
                this.tableModel.addTableModelListener(tableModelListener);
            clearSortingState();
            fireTableStructureChanged();
        public JTableHeader getTableHeader()
            return tableHeader;
        public void setTableHeader(JTableHeader tableHeader)
            if (this.tableHeader != null)
                this.tableHeader.removeMouseListener(mouseListener);
                TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
                if (defaultRenderer instanceof SortableHeaderRenderer)
                    this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
            this.tableHeader = tableHeader;
            if (this.tableHeader != null)
                this.tableHeader.addMouseListener(mouseListener);
                this.tableHeader.setDefaultRenderer
                        new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer())
        public boolean isSorting()
            return sortingColumns.size() != 0;
        private Directive getDirective(int column)
            for (int i = 0; i < sortingColumns.size(); i++)
                Directive directive = (Directive)sortingColumns.get(i);
                if (directive.column == column)
                    return directive;
            return EMPTY_DIRECTIVE;
        public int getSortingStatus(int column)
            return getDirective(column).direction;
        private void sortingStatusChanged()
            clearSortingState();
            fireTableDataChanged();
            if (tableHeader != null)
                tableHeader.repaint();
        public void setSortingStatus(int column, int status)
            Directive directive = getDirective(column);
            if (directive != EMPTY_DIRECTIVE)
                sortingColumns.remove(directive);
            if (status != NOT_SORTED)
                sortingColumns.add(new Directive(column, status));
            sortingStatusChanged();
        protected Icon getHeaderRendererIcon(int column, int size)
            Directive directive = getDirective(column);
            if (directive == EMPTY_DIRECTIVE)
                return null;
            return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
        private void cancelSorting()
            sortingColumns.clear();
            sortingStatusChanged();
        public void setColumnComparator(Class type, Comparator comparator)
            if (comparator == null)
                columnComparators.remove(type);
            else
                columnComparators.put(type, comparator);
        protected Comparator getComparator(int column)
            Class columnType = tableModel.getColumnClass(column);
            Comparator comparator = (Comparator) columnComparators.get(columnType);
            if (comparator != null)
                return comparator;
            if (Comparable.class.isAssignableFrom(columnType))
                return COMPARABLE_COMAPRATOR;
            return LEXICAL_COMPARATOR;
        private Row[] getViewToModel()
            if (viewToModel == null)
                int tableModelRowCount = tableModel.getRowCount();
                viewToModel = new Row[tableModelRowCount];
                for (int row = 0; row < tableModelRowCount; row++)
                    viewToModel[row] = new Row(row);
                if (isSorting())
                    Arrays.sort(viewToModel);
            return viewToModel;
        public int modelIndex(int viewIndex)
                 return getViewToModel()[viewIndex].modelIndex;     
        private int[] getModelToView()
            if (modelToView == null)
                int n = getViewToModel().length;
                modelToView = new int[n];
                for (int i = 0; i < n; i++)
                    modelToView[modelIndex(i)] = i;
            return modelToView;
        // TableModel interface methods
        public int getRowCount()
            return (tableModel == null) ? 0 : tableModel.getRowCount();
        public int getColumnCount()
            return (tableModel == null) ? 0 : tableModel.getColumnCount();
        public String getColumnName(int column)
            return tableModel.getColumnName(column);
        public Class getColumnClass(int column)
            return tableModel.getColumnClass(column);
        public boolean isCellEditable(int row, int column)
            return tableModel.isCellEditable(modelIndex(row), column);
        public Object getValueAt(int row, int column)
            return tableModel.getValueAt(modelIndex(row), column);
        public void setValueAt(Object aValue, int row, int column)
            tableModel.setValueAt(aValue, modelIndex(row), column);
        // Helper classes
        private class Row implements Comparable
            private int modelIndex;
            public Row(int index)
                this.modelIndex = index;
            public int compareTo(Object o)
                int row1 = modelIndex;
                int row2 = ((Row) o).modelIndex;
                for (Iterator it = sortingColumns.iterator(); it.hasNext();)
                    Directive directive = (Directive) it.next();
                    int column = directive.column;
                    Object o1 = tableModel.getValueAt(row1, column);
                    Object o2 = tableModel.getValueAt(row2, column);
                    int comparison = 0;
                    // Define null less than everything, except null.
                    if (o1 == null && o2 == null)
                        comparison = 0;
                    } else if (o1 == null)
                        comparison = -1;
                    } else if (o2 == null)
                        comparison = 1;
                    } else {
                        comparison = getComparator(column).compare(o1, o2);
                    if (comparison != 0)
                        return directive.direction == DESCENDING ? -comparison : comparison;
                return 0;
        private class TableModelHandler implements TableModelListener
            public void tableChanged(TableModelEvent e)
                // If we're not sorting by anything, just pass the event along.            
                if (!isSorting())
                    clearSortingState();
                    fireTableChanged(e);
                    return;
                // If the table structure has changed, cancel the sorting; the            
                // sorting columns may have been either moved or deleted from            
                // the model.
                if (e.getFirstRow() == TableModelEvent.HEADER_ROW)
                    cancelSorting();
                    fireTableChanged(e);
                    return;
                // We can map a cell event through to the view without widening            
                // when the following conditions apply:
                // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
                // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
                // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
                // d) a reverse lookup will not trigger a sort (modelToView != null)
                // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
                // The last check, for (modelToView != null) is to see if modelToView
                // is already allocated. If we don't do this check; sorting can become
                // a performance bottleneck for applications where cells 
                // change rapidly in different parts of the table. If cells
                // change alternately in the sorting column and then outside of            
                // it this class can end up re-sorting on alternate cell updates -
                // which can be a performance problem for large tables. The last
                // clause avoids this problem.
                int column = e.getColumn();
                if (e.getFirstRow() == e.getLastRow()
                        && column != TableModelEvent.ALL_COLUMNS
                        && getSortingStatus(column) == NOT_SORTED
                        && modelToView != null)
                    int viewIndex = getModelToView()[e.getFirstRow()];
                    fireTableChanged(new TableModelEvent(TableSorter.this,
                                                         viewIndex, viewIndex,
                                                         column, e.getType()));
                    return;
                // Something has happened to the data that may have invalidated the row order.
                clearSortingState();
                fireTableDataChanged();
                return;
        private class MouseHandler extends MouseAdapter
            public void mouseClicked(MouseEvent e)
                JTableHeader h = (JTableHeader) e.getSource();
                TableColumnModel columnModel = h.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = columnModel.getColumn(viewColumn).getModelIndex();
                if (column != -1)
                    int status = getSortingStatus(column);
                    if (!e.isControlDown())
                        cancelSorting();
                    // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
                    // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
                    status = status + (e.isShiftDown() ? -1 : 1);
                    status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
                    setSortingStatus(column, status);
        private static class Arrow implements Icon
            private boolean descending;
            private int size;
            private int priority;
            public Arrow(boolean descending, int size, int priority)
                this.descending = descending;
                this.size = size;
                this.priority = priority;
            public void paintIcon(Component c, Graphics g, int x, int y)
                Color color = c == null ? Color.GRAY : c.getBackground();            
                // In a compound sort, make each succesive triangle 20%
                // smaller than the previous one.
                int dx = (int)(size/2*Math.pow(0.8, priority));
                int dy = descending ? dx : -dx;
                // Align icon (roughly) with font baseline.
                y = y + 5*size/6 + (descending ? -dy : 0);
                int shift = descending ? 1 : -1;
                g.translate(x, y);
                // Right diagonal.
                g.setColor(color.darker());
                g.drawLine(dx / 2, dy, 0, 0);
                g.drawLine(dx / 2, dy + shift, 0, shift);
                // Left diagonal.
                g.setColor(color.brighter());
                g.drawLine(dx / 2, dy, dx, 0);
                g.drawLine(dx / 2, dy + shift, dx, shift);
                // Horizontal line.
                if (descending) {
                    g.setColor(color.darker().darker());
                } else {
                    g.setColor(color.brighter().brighter());
                g.drawLine(dx, 0, 0, 0);
                g.setColor(color);
                g.translate(-x, -y);
            public int getIconWidth()
                return size;
            public int getIconHeight()
                return size;
        private class SortableHeaderRenderer implements TableCellRenderer
            private TableCellRenderer tableCellRenderer;
            public SortableHeaderRenderer(TableCellRenderer tableCellRenderer)
                this.tableCellRenderer = tableCellRenderer;
            public Component getTableCellRendererComponent(JTable table,
                                                           Object value,
                                                           boolean isSelected,
                                                           boolean hasFocus,
                                                           int row,
                                                           int column)
                Component c = tableCellRenderer.getTableCellRendererComponent(table,
                        value, isSelected, hasFocus, row, column);
                if (c instanceof JLabel) {
                    JLabel l = (JLabel) c;
                    l.setHorizontalTextPosition(JLabel.LEFT);
                    int modelColumn = table.convertColumnIndexToModel(column);
                    l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
                return c;
        private static class Directive
            private int column;
            private int direction;
            public Directive(int column, int direction)
                this.column = column;
                this.direction = direction;
    }any input will be appreciated.
    thanks
    Peter

    The code you posted doesn't help us at all. Its just a duplicate of the code from the tutorial. The custom code is what you have written. For example do you update the TableModel from the Event Thread? Do you update the SortModel or the DefaultTableModel? If you actually provide your test code and somebody has already downloaded the sort classes, then maybe they will test your code against the classes. But I doubt if people will download the sort classes and create a test program just to see if they can duplicate your results (at least I know I'm not about to).

  • How to get Total of Manually added row in Report

    Hi everyone,
    I have a Input Schedule where user can add a row to the existing oneu2019s.  The account member ID which is added to the existing entry manually should be able to display total of the account memberu2019s Rate X Quantity in the report.  I have put Y in the Insert Member of EvDRE expansion on Account dimension and datasource dimension. User chooses the account and manual from datasource. The problem that I face in the report is u2013 datasourcetotal which is the hierarchy in datasource dimension is doing total (datasourcetotal) after every Upload and Manual entry. The reason why I chose datasource to do this task is that there is comment addition in every account row and comment for the manual entry need not be overwritten for the same account, so manual entry will segregate the comment in report display for the same account.
    In my datasource dimension it is like this u2013
    ID  | Hierarchy
    Manual | Datasourcetotal
    Upload | Datasourcetotal
    Datasourcetotal
    Before Range and After Range with SUM and SUB functions I believe cannot work in my situation as user can add rows anywhere in the EvDRE layout.
    Is there anyway that I can restrict Upload to display total in the report, whereas only total from Manual is displayed.
    Also if there is any other way to display dynamic row total in the reports aside from what I have tried above that will be wonderful , my mental faculties are not giving me any creative help, also I have looked around on SDN for anyone else facing the issue u2013 none found.
    Any pointers will be highly appreciated.
    Regards,
    Ben Ramos

    Hi,
    Evsub() function along with After Key range should help you adding the data from manually inserted data and displaying in your report.
    Please check my info on steps for how to implement evsub funtion in a report.
    BPC REPORTING
    In addition to what i have mentioned there for your case include Y for insert member in the member expansion range for Accout Dimension.
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • GeoMap Point Theme: how to get row data in a click listener?

    How can I get data (short of latitude, longitude, label and value) for a clicked FOI point from an iterator in a point theme click listener?
    In a bar/pie theme I can set location column to be the primary key column, and then in a listener do something like
    public void myClickListener(MapClickActionEvent mapClickActionEvent) {
        DataContent data = mapClickActionEvent.getDataContent();
        GeoRowObject row = data.getGeoRowObject();
        GeoObject key = row.getKey();
        Integer ID = Integer.valueOf(key.getLocation());
        // Use our ID to get data from an iterator
    But there's no such thing as a location column in the mapPointTheme.

    sorry ..I am using Jde11g
    and the reason i am using trinidad is ,I want checkbox option to select ,unselect multiple row .
    Even i also tried by adding one column with checkbox in ADF table but no success regarding same i also post question on thread but no any positive reply
    Problem with af:selectBooleanCheckbox added in ADf table's Column
    Edited by: JaydeepJ on Aug 12, 2009 3:06 AM

  • Basic row-by-row data entry

    I must just be missing something very simple here, because I can't imagine no one's asked this before if there's not a simple solution.
    My primary use for spreadsheets is to enter many rows of data. Each row has the same number of entries (columns), and is almost entirely numerical, so my workflow in Excel is to select a rectangular area with the appropriate numbers of rows and columns, and starting in the upper-left cell enter the data using the numeric keypad, hitting Enter after every number. When I get to the end of a row and hit Enter, the first (leftmost) cell of the next row is automatically selected. This seems to me to be the most logical, and possibly the only sensible way to enter many rows of data.
    But -- and I have to be wrong about this -- Numbers doesn't seem to include that functionality. A tab either moves me inexorably to the right, adding columns rather than moving to the beginning of the next row when I'm at the end of a row; and Return (or Enter) moves me inexorably down, adding rows when I hit bottom.
    This is just absurd, if it really is the way Numbers works. Is there some basic method of entry I'm missing? Using "shift-tab" simply isn't a viable option with a couple of dozen columns, and would be a substantial hit to productivity even with only one column.

    I had seen this posted elsewhere and tried it, and it doesn't work (Return always goes straight down). Fortunately, the page you point to does contain the correct answer. In order to make this work, "Return moves to next cell" must NOT be selected (the checkbox must be unchecked). In this case, tab moves to the beginning of the next row.
    Apple (if you're listening): This helps, but it's still pretty lame. Now the Tab key behaves like I want it to, but the Return key doesn't! Please don't change the behavior of both the Tab key and the Return key with a single option that sounds like it should affect only the behavior of the Return key.
    The optimal behavior would be to have separate options for Tab, Return, and (please, please please) keypad Enter.
    Message was edited by: derPlau

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • How to obtain the row data in the component datatable?

    if I want to edit a row data, and then know which row is edited in the component datatable, and how to do?
    How to obtain the row data in the component datatable, and update it to database, not simplely edit a simple table
    Any ideas? Thanks

    Thank you very much for your help Alexander !
    It's quite confusing when you leave Struts and try to adapt your projects for JSF for the first time...
    I wanted to click on a row with a "onMouseClick" on the TR tag like I used to do in Struts/JSTL. But it seems to be impossible in a dataTable.
    Ok then. I've added a column at the end of the row with an icon.
    But eventually I didn't need to declare link parameters.
    In my BackingBean I did like this :
    public String selectEventForUpdate() throws IllegalAccessException, InvocationTargetException {
            PortletAgenda event = (PortletAgenda) JSFUtils.getInRequestMap("event");
            BeanUtils.copyProperties(this, event);
            return null;
       }JSFUtils.getInRequestMap(...) is a method I wrote in a util object :
    public static Object getInRequestMap(String name) {
            Object res = null;
            Map requestMap=FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
            if (requestMap!=null) {
                res=requestMap.get(name);
            return res;
    }  " event " is the name of the item in my dataTable list.
    My backingBean has the same attributes as "event".
    So when the page is reloaded I have a backingBean full with the selected properties to edit/update.
    Thanks to your reply I realized that putting this form in the middle of the dataTable seems to be impossible.
    So I put this form in a floating DIV in front of the table with a shadow.
    It works :o) !
    But I'm a little bit disapointed to be honest...
    I used to build my web applications with Struts and JSTL and doing this kind of interface was really easy.
    I've decided 3 days ago to convert into JSF because the "GUI Layer" seemed to be improved.
    But now I realize that I cannot put a onMouseOver and onMouseClick on a row and I cannot display a different row in the middle of a table....
    I think it's a shame because there is a facet for header and footer.
    And it would be great if we could create our own personal facet that appears only if a condition is true.
    For exemple " if the current item id is the same as the request parameter id then display the following facet content ....... (with a panel group and a form inside to update the row) "
    It's easy to do that with JSTL thanks to c:forEach and c:if but it seems to be impossible to use JSTL tags like this during the dataTable iteration.
    And JSF tags seems to have no logical tags like " if " or loops that can be nested in dataTable.
    I really need to realize this interface (you click on a row then an edit form appears where you clicked).
    Do I have to write a component myself that extends dataTable?
    Do you know if writing such a component is hard to do for a beginner like me?
    (I've juste discovered JSF 3 days ago and I've used Struts/JSTL for 2 years til now)
    I'd be glad to have much advices from you about that.
    Regards

  • Numbers missing reference after adding rows

    Hi,
    I came into a strange situation (which I did not have before).
    I have a sheet summary contaning formulas that uses cells from a different sheet. The source sheet contains more than 100 rows containing different numbers which are used in more than 50 formulas in the summary sheet.
    When adding rows inbetween the existing data sheet rows, I see that the summary sheet furmulas, in some cases, do not reference to the correct row number (they all should shift to the new row number) any more (out of 50 references only four got currapted).
    Any ideas are appriciated (is this a known bug).
    Thanks,
    Ziv

    Ziv,
    First, I want to thank you for asking a question that got me thinking about something I hadn't really considered before.
    I am not entirely sure I understand your question or the test you proposed in the second post, but if I am reading it correctly, what you are expecting is the way Numbers is designed to work (and the way I have seen it work) and when I try the test from your second post I get the results I expect.
    That is, a cell reference points to a cell, not a location; if you move that cell (for example, by adding a row above it, which moves it down one row) the reference in the formula is updated to reflect the new location, but the result of the calculation doesn't change.
    But this got me wondering about how Numbers dealt with references to ranges of cells. For example, the formula =SUM(C3:C6) is equivalent to =SUM(C3, C4, C5, C6), but what happens when you add a row after row 4? Apparently, the second expression remains a sum of the values in four cells, but the values of C5 and C6 are changed to reflect the fact that they have moved to C6 and C7. However, in the first expression, the new cell is added to the range, so that it is now the sum of five values. Actually, if you add a row (or column) to one that passes through a range, in the middle, or on the outside, the formula updates to add the new cell to the range, even if you are adding cells immediately below the bottom row in the range (so none of the cells in the original range actually move).
    I'm not sure any of this has much to do with your problem, unless possibly one (or four) of your expressions is referring to a range that happens to be one cell, which would update differently from one referencing a simple cell. As Jerry has said, it's pretty hard to know anything without knowing what expressions your formulas are using.
    At any rate, thanks for making me think about something I hadn't explored before.

  • Interactive form in WD4A - dynamic table - adding rows

    Hi,
    I have a problem with dynamic table in WD4A. User can add row to table by clicking a button on form, but added rows are not transfered to mapped context node in my web dynpro application. I have made a lot of searches on SDN and I have found a lots of threads, but no answer.
    Maybe this should be a way:
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] - Read adobe data manually and create context element manualy too.. But I think this should be a part of webdynpro/interactive forms framework.
    Thanks for any answer!

    Hi, many thanks for your answer, so what do you think is the best solution for adding rows by user to interactive form's dynamic table?
    Manually read xml data during submit by this way: https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] ?
    Or is there better solution for this? (any link to some examples, blogs, etc...)
    Many thanks for any answer!

  • Dynamic datatable:adding rows

    I am working with Dynamic datatable . whilke adding a row i am able to add only one row . later i am unable to a dd .
    code:
    <h:commandLink value="ADD" action="#{icdMBean.actionAddrow}" />
    back bean:
    public void actionAddrow() {
    // Create new items.
    icdList= new ArrayList<Icd>();
    Icd myNewDataItem = new Icd();System.out.println("i am in action add row2");
    myNewDataItem.setId("new");
    icdList.add(myNewDataItem);
    if i set the id value( myNewDataItem.setId("new");) only i am able to add only one row .
    could you please suggest a solution for it.

    Hi, many thanks for your answer, so what do you think is the best solution for adding rows by user to interactive form's dynamic table?
    Manually read xml data during submit by this way: https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] ?
    Or is there better solution for this? (any link to some examples, blogs, etc...)
    Many thanks for any answer!

  • Adding rows to a table

    Hi All,
    My application has few JSP pages , one of the JSP page generates HTML table with textboxes & hyperlinks(in table cells) populated with data pulled from the database. I have an "Add" button to add new empty rows. Add I'm performing via DOM. And this works well. But when I click the hyperlink go to another jsp page get data and return to first page(page with table) page all changes(added rows ) are disappeared....
    How do I solve this................ Thanks in advance.

    one thing to solve this is to put a variable(# of rows that you added) into session, hidden element, or db as record.. then if you go to the next page and go back to the previous page.. you will request for the variable(# of rows that you added) then you will use it in your loop in javascript to call the function that adds the rows

  • How to retrieve table rows data and add into DB

    Hi All,
    I'm a beginner in JAVAFX, I have developed a table and adding the data into the table in multiple rows. on button click I would like these rows to be added into DB.
    Please could anyone help on this. I'm copy the code for reference.
    CODE:
    import javafx.ext.swing.SwingComponent;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    package class TableColumn{
    public var text: String;
    package class TableCell{
    public var text: String;
    public var id;
    public var str:String;
    public var str1:String[];
    public var num:Number;
    package class TableRow{
    public var cells: TableCell[];
    package class SwingTable extends SwingComponent{
    var table: JTable;
    var model:DefaultTableModel;
    public var selection: Integer;
    public var columns: TableColumn[] on replace{
    model = new DefaultTableModel(for(column in columns) column.text, 0);
    table.setModel(model);
    public var rows: TableRow[] on replace oldvalue[lo..hi] = newVals{
    for(index in [hi..lo step -1]){
    model.removeRow(index);
    for(row in newVals){
    model.addRow(for(cell in row.cells) cell.text);
    public override function createJComponent(){
    table = new JTable();
    model = table.getModel() as DefaultTableModel;
    var selectionModel = table.getSelectionModel();
    selectionModel.addListSelectionListener(
    ListSelectionListener{
    public override function valueChanged(e: ListSelectionEvent ) {
    selection = table.getSelectedRow();
    return new JScrollPane(table);
    }

    Instead of using a combo box, using a text ring makes it much easier to disable items in the list. Here is a vi that will do what you want. Also you can delete the last element in the table and make it enabled in the text ring for selecting again.
    - tbob
    Inventor of the WORM Global
    Attachments:
    test_table[1].vi ‏75 KB

  • Setting corect value in JTable while adding row @ run time

    HI All,
    Iam facing the following problems in Java Swing while using JTable..
    I have a JTable with 11 colums and i add row on run time..
    Since i needed the 11th column of the table to be of type CheckBox i used the follwing object in the DefaultTableModel class..
    Object[][] data =
                   {"1", "", "", "", "", "", new Double(0.0), new Integer(0), new Double(0.0), new Double(0.0),new Boolean(false) }
    When ever i wan't to delete a row i will click the Boolean Object ( which appears as a Check box ) and then delete that row.. For deleteing i am using 1 methods..
    1. By selecting the col by mouse and the click a button to delete the selected rows...
    2. By selecting the col by key board , using a Menu ShortCut key ( CTRL-F ) and then using the space key to on the value , then i use another Menu ShortCut key ( CTRL-D ) to delete all the selected rows..
    The above 2 methods work fine as for as deleting is concerned..
    But the problem starts while adding another row after deleting one or more rows..That 2 happens while the deletion had been done by the KEYBORD only..
    The problem is...
    If there is more than 1 rows and i select some rows of any order..And then delete them with the Keyboard option..and then add a rows , while adding the row @ the postion where the last row was deleted iam getting the 11th col. value ( which apears as a check box ) as selected..For example if there is 4 rows and i delete the 3rd and 4th row and then when i add rows its fine for the 3rd row and for the 4th row ( which was the last one which was slected to be deleted ) i get the option as a selected one..
    But while adding i use the above said Data object only..I then used the the
    JTablename.getValueAt(i,10); to print the value and iam geting false only..
    And more over when i try to focus in the cell in 1st row last column of the table by the setSelection method , the focus goes to the cell which appears to be enbled..
    My friends asked me to use the follwing methods before adding rows ..
    1. clearSelection()
    2. Validate()
    3. repaint()
    But the problem seems not over can anyone help....
    U can mail me to [email protected]
    Love,.
    Siva

    Yes, relatively easily, I think.
    In your end jump script set a second value in a different GPRM that identifies the last film played. This way the play all flag is set and you know which clip has just been seen.
    On resuming the play all you need to reset the play all flag to '1' and then look at the other GPRM to see which clip played last. Use a bunch of jump commands to get back in to the playback at the start of the next logical clip and it should continue through as before.
    The secret here is to clear the play all flag when showing a few clips, but use your 'resume play all' button to reset the flag and see where you were by reading the other GPRM.
    The downside here is that you could be in clip 3 when you exit the play all, but you would have to resume clip 3 from the start when you return as the 'Resume' info will get cleared if you start showing other clips in the mean time.
    Have you also considered setting up a video jukebox? You could then pick a selection of tracks to play in the order they were chosen and leave them to run through. This is a much trickier bit of scripting, but very possible!
    Stories could have made things easier, but given the set-up that you have built you can still get what you need from the scripting

Maybe you are looking for