Iterate over NSMutableArray with indexPath row - EXC_BAD_ACCESS

Hi there,
I recently started developing iPhone applications and I'm currently trying to create an app that displays a forum a friend and me created.
I have created custom classes for categories and forums (basically, they just have properties like the rows in the database), as well as a DataController-Class which is instantiated in the different TableViewControllers. Data is read via XML and stored in a NSMutableArray (I also tried NSMutableDictionary).
This works well for getting the categories, put them in an array/dictionary and display them, given the current indexPath row index.
But when it comes to displaying the forums, my app crashes with an EXCBADACCESS.
Here's some code, I hope it's enough:
ViewController:
- (void)viewDidLoad {
[super viewDidLoad];
dc = [[DataController alloc] init];
[dc initCategoryList];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
XLog("indexPath row: %d", [indexPath row]);
Category *currentCategory = [[dc CategoryList] categoryAtIndex:[indexPath row] ];
UILabel *labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, cellWidth * 0.75, 30) ];
[labelTitle setFont:[UIFont boldSystemFontOfSize:18.0] ];
[labelTitle setText:[currentCategory strcattitle] ]; <-- crashes here
/* do some stuff */
return cell;
CategoryList (replace Category with Board and you have the similar class)
@implementation CategoryList
@synthesize categories;
- (id)init {
if ( self = [super init] ) {
categories = [[NSMutableArray alloc] init];
return self;
- (void)addCategory:(Category *)_Category {
XLog("adding category (%@) at %d...", _Category, [categories count]);
[categories addObject:_Category];
XLog("ok");
- (NSString *)description {
NSMutableString *description = [[NSMutableString alloc] initWithFormat:@"<CategoryList> %d elements\r\n",
[categories count]];
for ( int i = 0; i < [categories count]; i++) {
[description appendFormat:[[categories objectAtIndex:i] description]];
[description appendFormat:@"\r\n"];
return description;
- (Category *)categoryAtIndex:(NSUInteger)index {
return [categories objectAtIndex:index];
- (void)dealloc {
[categories release];
[super dealloc];
Category
@implementation Category
@synthesize id_cat, strcattitle, int_boardcount;
- (id)initWithId:(NSInteger)idcat
title:(NSString *)str_cattitle
boardcount:(NSUInteger)intboardcount {
if ( self = [super init] ) {
id_cat = idcat;
strcattitle = str_cattitle;
int_boardcount = intboardcount;
return self;
- (NSString *)description {
return [NSString stringWithFormat:@"<Category> id_cat = %d, strcattitle = %@, int_boardcount = %d",
id_cat, strcattitle, int_boardcount];
- (void)dealloc {
[strcattitle release];
[super dealloc];
The error occurs when I try to access the objects' properties in the TableViewController. The index of the objects that are stored in the corresponding list seem to be of different types.
P.S.: How do I post code with a fixed font here?
Message was edited by: HoPi`
Message was edited by: HoPi`

I do not see your forum code to comment, but you probably are not trying to access the string field. The other possibility is that the input pointer is still valid (not dealloc'ed elsewhere in your code, but this is something you should never bank on. You can use self.xyz, or [self setXyz] which are complimentary. If you do not want to use the property/accessor, you can copy the input or send a retain message to the variable. Bottom line is you need a retain/copy message to be sent for subsequent access to work.

Similar Messages

  • Problem with indexPath.row method...??????

    I have 5 elements in array but indexPath.row returns 0,i dont know why...????
    Thats why it is giving me an error of NSNull Length
    would you pls help me in this exception...?????

    Thats a code related error, but there is not enough clde lines to tell where in your code. Sorry.

  • How can a TableView iterate over Rows and get Cells?

    I need to iterate over all the rows in a TableView without using Events. I would like to get the total number of rows, the TableRow, and a Cell from a specified TableColumn in the TableRow.
    Something like this:
    for(TableRow tableRow: tableView.getRows()){
        Cell cell = tableRow.getColumn(4).getCell();
        // do something to the cell
    }Is this possible?
    Edited by: Conzar on May 19, 2013 11:18 PM

    However, the problem with the CheckBox has been resolved so I don't need to iterate over the rows any longer.Yep, not using lookups to handle this is a much better solution, I just provided my lookup based solution because you asked for an iterative solution.
    The (lookup) code below doesn't produce any output.It works for me, I included an executable sample so you can try it out.
    My guess is that you aren't taking into account the fact that the lookup is just a snapshot of the table's cells at a moment in time.
    If you do a cell lookup before you show the table on a stage, it's not going to return anything because the cells are only generated on an as needed basis and there is no need to generate any cells before displaying the table on a stage.
    I get the following output on Java8b89 Win7:
    NumberedTableViewSample$2$1@344fe46[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@44187690[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@34618adc[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@61eb7609[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@50b006a1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@307d4153[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@89b7483[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@70ce61fd[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@178969ad[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@e3149ea[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3683d879[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@589e421f[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@7e26215b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@69d59720[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1ad26ff1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@32b058e4[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@582e254[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@261c4ebd[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2cb9cfb[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@63c6fe00[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@16a98443[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@58247401[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@34dc3da4[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@78a62ea[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@29e0032e[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1781c971[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@18b2e479[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@4801295b[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@19e4c622[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6a766d41[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@572aed5d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3bdf71a4[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@524c48c7[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@47b5a3ea[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6ef8b38b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7fd2ee72[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@4994195c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@49620450[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@246d8751[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@17e90472[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@def00[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@d1aa50a[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2a7a58ba[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@2675cbd1[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@1c06ee08[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1685718d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@6ba1936c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@61ef15e5[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@6b2ace30[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3c4d17c7[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1c3c9aad[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@27eadfe[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@3f83a064[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@579615f1[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@52a9271b[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1d221557[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@18947d9e[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@537eab32[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@687cc257[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@3d524978[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@44554375[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@22f89594[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@1f891aaf[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@bafcb2f[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@7ddeea8c[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@26023325[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@4b14700f[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@89eb58[styleClass=cell indexed-cell table-cell table-column]
    NumberedTableViewSample$2$1@6a55a4a6[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7d95454d[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@375592eb[styleClass=cell indexed-cell table-cell table-column]
    TableColumn$1$1@7add3f35[styleClass=cell indexed-cell table-cell table-column]TestApp:
    import javafx.application.Application;
    import javafx.beans.property.ReadOnlyObjectWrapper;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableColumn.CellDataFeatures;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class NumberedTableViewSample extends Application {
        private TableView<Person> table = new TableView<>();
        private final ObservableList<Person> data =
            FXCollections.observableArrayList(
                new Person("Jacob", "Smith", "[email protected]"),
                new Person("Isabella", "Johnson", "[email protected]"),
                new Person("Ethan", "Williams", "[email protected]"),
                new Person("Emma", "Jones", "[email protected]"),
                new Person("Michael", "Brown", "[email protected]")
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) {
            Scene scene = new Scene(new Group());
            stage.setTitle("Table View Sample");
            stage.setWidth(470);
            stage.setHeight(500);
            final Label label = new Label("Address Book");
            label.setFont(new Font("Arial", 20));
            table.setEditable(true);
            TableColumn numberCol = new TableColumn("#");
            numberCol.setMinWidth(20);
            numberCol.setCellValueFactory(new Callback<CellDataFeatures<Person, Person>, ObservableValue<Person>>() {
              @Override public ObservableValue<Person> call(CellDataFeatures<Person, Person> p) {
                return new ReadOnlyObjectWrapper(p.getValue());
            numberCol.setCellFactory(new Callback<TableColumn<Person, Person>, TableCell<Person, Person>>() {
              @Override public TableCell<Person, Person> call(TableColumn<Person, Person> param) {
                return new TableCell<Person, Person>() {
                    @Override protected void updateItem(Person item, boolean empty) {
                        super.updateItem(item, empty);
                        if (this.getTableRow() != null && item != null) {
                          setText(this.getTableRow().getIndex()+"");
                        } else {
                          setText(null);
            numberCol.setSortable(false);
            TableColumn firstNameCol = new TableColumn("First Name");
            firstNameCol.setMinWidth(100);
            firstNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("firstName"));
            TableColumn lastNameCol = new TableColumn("Last Name");
            lastNameCol.setMinWidth(100);
            lastNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("lastName"));
            TableColumn emailCol = new TableColumn("Email");
            emailCol.setMinWidth(200);
            emailCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("email"));
            table.setItems(data);
            table.getColumns().addAll(numberCol, firstNameCol, lastNameCol, emailCol);
            final VBox vbox = new VBox();
            vbox.setSpacing(5);
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table);
            // this lookup set won't print anything as no cells have been generated.
            for (Node r: table.lookupAll(".table-row-cell")){
                for (Node c: r.lookupAll(".table-cell")){
                    System.out.println(c);
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
            stage.setScene(scene);
            stage.show();
            // now the table has been initially rendered and it's initial set of cells generated,
            // the cells can be looked up.
            for (Node r: table.lookupAll(".table-row-cell")){
                for (Node c: r.lookupAll(".table-cell")){
                    System.out.println(c);
        public static class Person {
            private final SimpleStringProperty firstName;
            private final SimpleStringProperty lastName;
            private final SimpleStringProperty email;
            private Person(String fName, String lName, String email) {
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.email = new SimpleStringProperty(email);
            public String getFirstName() {
                return firstName.get();
            public void setFirstName(String fName) {
                firstName.set(fName);
            public String getLastName() {
                return lastName.get();
            public void setLastName(String fName) {
                lastName.set(fName);
            public String getEmail() {
                return email.get();
            public void setEmail(String fName) {
                email.set(fName);
    }

  • Aperture shared over a network for viewing with Front Row?

    Aperture shared over a network for viewing with Front Row? I can view iPhoto from my laptop or desk top but I cannot find a way to share Aperture over the network.

    If tested to work with other MacOs versions, this should be a main FAQ listed on Apple's Support website for Aperture and/Mac OSX.

  • How can I iterate over the columns of a REF CURSOR?

    I have the following situation:
    DECLARE
       text   VARCHAR2 (100) := '';
       TYPE gen_cursor is ref cursor;
       c_gen gen_cursor;
       CURSOR c_tmp
       IS
            SELECT   *
              FROM   CROSS_TBL
          ORDER BY   sn;
    BEGIN
       FOR tmp IN c_tmp
       LOOP
          text := 'select * from ' || tmp.table_name || ' where seqnum = ' || tmp.sn;
          OPEN c_gen FOR text;
          -- here I want to iterate over the columns of c_gen
          -- c_gen will have different number of columns every time,
          --        because we select from a different table
          -- I have more than 500 tables, so I cannot define strong REF CURSOR types!
          -- I need something like
          l := c_gen.columns.length;
          for c in c_gen.columns[1]..c_gen.columns[l]
          LOOP
              -- do something with the column value
          END LOOP;
       END LOOP;
    END;As you can see from the comments in the code, I couln'd find any examples on the internet with weak REF CURSORS and selecting from many tables.
    What I found was:
    CREATE PACKAGE admin_data AS
       TYPE gencurtyp IS REF CURSOR;
       PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
    END admin_data;
    CREATE PACKAGE BODY admin_data AS
       PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
       BEGIN
          IF choice = 1 THEN
             OPEN generic_cv FOR SELECT * FROM employees;
          ELSIF choice = 2 THEN
             OPEN generic_cv FOR SELECT * FROM departments;
          ELSIF choice = 3 THEN
             OPEN generic_cv FOR SELECT * FROM jobs;
          END IF;
       END;
    END admin_data;
    /But they have only 3 tables here and I have like 500. What can I do here?
    Thanks in advance for any help!

    The issue here is that you don't know your columns at design time (which is generally considered bad design practice anyway).
    In 10g or before, you would have to use the DBMS_SQL package to be able to iterate over each of the columns that are parsed from the query... e.g.
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_rowcount  NUMBER := 0;
    BEGIN
      -- create a cursor
      c := DBMS_SQL.OPEN_CURSOR;
      -- parse the SQL statement into the cursor
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      -- execute the cursor
      d := DBMS_SQL.EXECUTE(c);
      -- Describe the columns returned by the SQL statement
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      -- Bind local return variables to the various columns based on their types
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
        END CASE;
      END LOOP;
      -- Display what columns are being returned...
      DBMS_OUTPUT.PUT_LINE('-- Columns --');
      FOR j in 1..col_cnt
      LOOP
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                                  when 2 then 'NUMBER'
                                                                                  when 12 then 'DATE'
                                                         else 'Other' end);
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('-------------');
      -- This part outputs the DATA
      LOOP
        -- Fetch a row of data through the cursor
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        -- Exit when no more rows
        EXIT WHEN v_ret = 0;
        v_rowcount := v_rowcount + 1;
        DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
        DBMS_OUTPUT.PUT_LINE('--------------');
        -- Fetch the value of each column from the row
        FOR j in 1..col_cnt
        LOOP
          -- Fetch each column into the correct data type based on the description of the column
          CASE rec_tab(j).col_type
            WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
            WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
          END CASE;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('--------------');
      END LOOP;
      -- Close the cursor now we have finished with it
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    DEPTNO - NUMBER
    SAL - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    DEPTNO : 10
    SAL : 2450
    Row: 2
    EMPNO : 7839
    ENAME : KING
    DEPTNO : 10
    SAL : 5000
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    DEPTNO : 10
    SAL : 1300
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    JOB - VARCHAR2
    MGR - NUMBER
    HIREDATE - DATE
    SAL - NUMBER
    COMM - NUMBER
    DEPTNO - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    JOB : MANAGER
    MGR : 7839
    HIREDATE : 09/06/1981 00:00:00
    SAL : 2450
    COMM :
    DEPTNO : 10
    Row: 2
    EMPNO : 7839
    ENAME : KING
    JOB : PRESIDENT
    MGR :
    HIREDATE : 17/11/1981 00:00:00
    SAL : 5000
    COMM :
    DEPTNO : 10
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    JOB : CLERK
    MGR : 7782
    HIREDATE : 23/01/1982 00:00:00
    SAL : 1300
    COMM :
    DEPTNO : 10
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from dept where deptno = 10');
    -- Columns --
    DEPTNO - NUMBER
    DNAME - VARCHAR2
    LOC - VARCHAR2
    Row: 1
    DEPTNO : 10
    DNAME : ACCOUNTING
    LOC : NEW YORK
    PL/SQL procedure successfully completed.
    SQL>From 11g onwards, you can create your query as a REF_CURSOR, but then you would still have to use the DBMS_SQL package with it's new functions to turn the refcursor into a dbms_sql cursor so that you can then describe the columns in the same way.
    http://technology.amis.nl/blog/2332/oracle-11g-describing-a-refcursor
    Welcome to the issues that are common when you start to attempt to create dynamic code. If your design isn't specific then your code can't be either and you end up creating more work in the coding whilst reducing the work in the design. ;)

  • Web dynpro screen with multiple rows with columns that can be edited

    Web dynpro screen with multiple rows with columns that can be edited individually:
    Hi
    I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7).
    I need to add 'n type of table (or almost something like Excel) or something in which someone can type a few paycode numbers (there should be lets say 10 blank rows in which info can be typed in and if I click on a button or so, more rows must be added if necessary.  Then in the other colums stuff like amounts must be entered which one should also be able to edit then and there.
    Can anyone assist in what I can use for this?  There does not seem to be some existing element that I can use.
    Help will be appreciated.
    Regards
    Debbie

    Hi Debbie,
    Whiel Creating table you need to be care full that use chose INPUT FIELD as the CELL EDITOR. Just guessing that if ur table is not editable u might have choosen TextView as default cell editor type.
    check link for details on TABLE UI
    [http://help.sap.com/saphelp_erp2005/helpdata/EN/b5/ac884118aa1709e10000000a155106/frameset.htm]
    easy way is to first add UI ELEMENT TABLE to your VIEW, then right click over it & select create binding from context. After you have a pop up where you can select what columns you want what should be its cell editor etc.
    Greetings
    Prashant

  • Session Problems: "Don't know how to iterate over supplied "items""

    Hi, I am developing my first application using Struts and JSP. The Action Form loads an object called reportGrid into session and I am trying to display it on a JSP page. Displaying simple variables works fine, but I can display an object. The error I receive is: Don't know how to iterate over supplied "items"
    My object is made up of a group of ArrayLists looks similar to this this:
            private List affiliateID;
         private List affiliateName;
         private List product1;
         private List product2;
         //etc for about 10 listsThe object is filled with data from a result set and placed into session like:
         HttpSession session = request.getSession();
         session.setAttribute("grid", reportGrid);The goal is to display each list in its own column in a HTML table.
    <table>
    <tr>
    <c:forEach var="affiliateName" items="${grid}">
              <td>
                   <c:out value="${affiliateName}" />
              </td>     
         </c:forEach>
         <c:forEach var="product1" items="${grid}">
              <td>
                   <c:out value="${product1}" />
              </td>     
         </c:forEach>
         <c:forEach var="product2" items="${grid}">
              <td>
                   <c:out value="${product2}" />
              </td>     
         </c:forEach>
    </tr>
    </table>I'm sure this has been asked before but I could not find any examples in the forums. I can place an ArrayList directly into session and iterate through using <c:forEach tags but when I try to do the same with an object it gives me the error " Don't know how to iterate over supplied "items" ".
    Does anyone have any examples of pulling and displaying an object in session which contains ArrayLists? I have been stuck on this same error for a while and any help will be greatly apreciated.
    James.          

    What is the type of grid?

  • Performance problem on a table with zero rows

    I queried the v$sqlarea table to find which SQL statement was doing the most disk reads and it turned out to be a query that read 278 Gigabytes from a table which usually has zero rows. This query runs every minute and reads any rows that are in the table. It does not do any joins. The process then processes the rows and deletes them from the table. Over the course of a day, a few thousand rows may be processed this way with a row length of about 80 bytes. This amounts to a few kilobytes, not 278 Gig over a couple of days. Buffer gets were even higher at 295 Gig. Note that only the query that reads the table is doing these disk reads, not the rest of the process.
    There are no indexes on the table, so a full table scan is done. The query reads all the rows, but usually there are zero. I checked the size of the table in dba_segments, and it was 80 Meg. At one point months ago, during a load, the table had 80 Meg of data in it, but this was deleted after being processed. The size of the table was never reduced.
    I can only assume that Oracle is doing a full table scan on all 80 Meg of this table every minute. Even when there are zero rows. Dividing the buffer gets in bytes by the number of executions yields 72 Meg which is close to the table size. Oracle is reading the entire table size from disk even when the table has zero rows.
    The solution was to truncate the table. This helped immediately and reduced the disk reads to zero most of the time. The buffer gets were also reduced to 3 per execution when the table was empty. The automatic segment manager reduced the size of the table to 64k overnight.
    Our buffer cache hit ratio was a dismal 72%. It should go up now that this problem has been resolved.
    Table statistics are gathered every week. We are running Oracle 9.2 on Solaris.
    Note that this problem is already resolved. I post it because it is an interesting case.
    Kevin Tyson, OCP
    DaimlerChrysler Tech Center, Auburn Hills, MI

    Kevin,
    The solution was to truncate the tableThis is not a scoop... isn't it ?
    Table statistics are gathered every weekIs there any reason for that ?
    If stats ran when no rows, perf can be very bad after loading data, and if stats ran when thousand rows, perf can be very bad after deleting. Perhaps can you find a more restrictive stat running ?
    Nicolas.
    Message was edited by:
    N. Gasparotto

  • Need help with Pivoting rows to columns

    Hi,
    I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
    There are two tables say Table 1 and Table 2.
    Table1
    name address email identifier
    x e g 1
    f s d 2
    h e n 3
    k l b 4
    Table2
    identifier TRno zno bzid
    1 T11 z11 b11
    1 T12 z12 b12
    1 T13 z13 b13
    2 T21 z21 b21
    2 T22 z22 b22
    As you can see the identifier is the column that we use to map the two tables. The output should be like below
    output
    name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
    x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
    f s d 2 T21 z21 b21 t22 z22 b22
    Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
    All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
    So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more information

    Something like this ?
    SCOTT@orcl> ed
    Wrote file afiedt.buf
      1  select a.name,
      2  a.address,
      3  a.email,
      4  b.* from (
      5  select distinct identifier
      6  ,max(trno1) trno1
      7  ,max(zno1) zno1
      8  ,max(bzid1) bzid1
      9  ,max(trno2) trno2
    10  ,max(zno2) zno2
    11  ,max(bzid2) bzid2
    12  ,max(trno3) trno3
    13  ,max(zno3) zno3
    14  ,max(bzid3) bzid3
    15  ,max(trno4) trno4
    16  ,max(zno4) zno4
    17  ,max(bzid4) bzid4
    18  from (select identifier
    19  ,decode(rn,1,trno,null) trno1
    20  ,decode(rn,1,zno,null) zno1
    21  ,decode(rn,1,bzid,null) bzid1
    22  ,decode(rn,2,trno,null) trno2
    23  ,decode(rn,2,zno,null) zno2
    24  ,decode(rn,2,bzid,null) bzid2
    25  ,decode(rn,3,trno,null) trno3
    26  ,decode(rn,3,zno,null) zno3
    27  ,decode(rn,3,bzid,null) bzid3
    28  ,decode(rn,4,trno,null) trno4
    29  ,decode(rn,4,zno,null) zno4
    30  ,decode(rn,4,bzid,null) bzid4
    31  from (select identifier,
    32  trno,bzid,zno,
    33  dense_rank() over(partition by identifier order by trno,rownum) rn
    34  from table2)
    35  order by identifier)
    36  group by identifier) b,table1 a
    37* where a.identifier=b.identifier
    SCOTT@orcl> /
    NAME       ADDRESS    EMAIL      IDENTIFIER TRNO1      ZNO1       BZID1      TRNO2      ZNO2       BZID2      TRNO3      ZNO3       BZID3      TRNO4      ZNO4       BZID4
    x          e          g          1          T11        z11        b11        T12        z12        b12        T13        z13        b13
    f          s          d          2          T21        z21        b21        T22        z22        b22
    SCOTT@orcl> select * from table1;
    NAME       ADDRESS    EMAIL      IDENTIFIER
    x          e          g          1
    f          s          d          2
    h          e          n          3
    k          l          b          4
    SCOTT@orcl> select * from table2;
    IDENTIFIER TRNO       ZNO        BZID
    1          T11        z11        b11
    1          T12        z12        b12
    1          T13        z13        b13
    2          T21        z21        b21
    2          T22        z22        b22
    SCOTT@orcl>Regards
    Girish Sharma

  • Submitting a cfform with multiple rows in it

    so I've got a form that contains several rows, each with a qty input box
    how do you loop through all the form items ?

    I think I worded that incorrectly.
    I need to update corresponding fields in a table based on a form with several rows in it
    each row consists of [table_key] and [qty]
    whats the best approach ? I've looked all over for info, but I can't seem to accurately describe what I need, to a search engine
    eg.
    update table
    set table.qty = #form.qty#
    where table.key = #form.table_key#
    when I output the contents of the form, it appears to put each form field in a list eg.
    <cfoutput>#form.qty#</cfoutput>
    produces 1,3,5,2 (there's 4 qty boxes on the form)
    Im just not sure how to a) establish how many list elements there are and b) index through each list element

  • Putting Three Cells into one Table Cell but with Three rows of data?

    How do I do this.
    I see no way to increment the indexPath row.
    I have data grouped by category and I want to show three items per line.
    Is there an example or such on how to increment the indexpath
    thanks

    One way to think about this problem is by filtering. You can create 'Booked Gig Tracking' and 'Try Again 2009' tables that are merely copies of the main table (with columns omitted as desired). These two tables would be populated with simple formulas like =MainTable :: Name in the Name column and =MainTable :: Address in the Address column. Make sure to copy the appropriate check column as well. Then each of these two tables can be filter to show only the items that are checked.
    This is a pretty sketchy description of the idea. If you need something more detailed, ask.

  • Iterate over f:selectItems

    Hi, I want to iterate over a collection which is not <String> type.
    <h:selectOneRadio value="#{PodkategorieBean.idKategorie}">
         <f:selectItems value="#{PodkategorieBean.vsechnyKategorie.id}" />
    </h:selectOneRadio>vsechnyKategorie is a List<Category>
    Category class has id property with getter and setter and is Long
    When I run this, I get error
    For input string: "id"
    which has probably roots in the fact that "id" is not a collection.
    Do you know how to access the property in this case?
    Thanks for answering.

    It should be a list of select items...
    public ArrayList getSelectItemList() {
       ArrayList aList = new ArrayList();
       for(Category category : this.vsechnyKategorie){
          if(category.getId() != null){
         aList.add(new SelectItem(category.getId(), category.getId()));
       return aList;
    <h:selectOneRadio value="#{PodkategorieBean.idKategorie}">
         <f:selectItems value="#{PodkategorieBean.selectItemList}" />
    </h:selectOneRadio>

  • Iterate over Map

    Hi
    I have to override toString() to print out everything in my HashMap. It�s like I have a totally black out. Help me please.
    This is what I have:
    This Map is a graph filled with Cities and each City has an ListArray with Edges (containing info about transport way and weight of edge, in this case, time it takes to transport from one node to another).
    This is how my Map looks like in a class called ListGraph<N>
    Map<N, List<Edge<N>>> all = new HashMap<N, List<Edge<N>>>();So first I put Cities into my Graph whith addNode method from main-method somewhere:
    all.put(city, new ArrayList<Edge<N>>());Then I connect each node (City) with another node.
    myGraph.connect("Universe", "Galaxy", "Train", 35);myGraph is a Graph myGraph in main-method
    Now I want to print out my graph with toString() method
    like
    System.out.println(myGraph);How do I iterate over my Map and use toString so it looks like this:
    from Universe:  to Galaxy by Train(35)And if Universe has more edges they should also be printed out like
    from Universe:  to Galaxy by Train(35), to the Sun(85), to foodcourt(2)Someone?

    How do I iterate over my Map and use toString so it
    looks like this:
    from Universe:  to Galaxy by Train(35)
    A usual way to iterate over map is:
         Map<A, B> map = new HashMap<A, B>();
         // map.put(new A("a1"), new B("b1"));
         // map.put(new A("a2"), new B("b2"));     
         for(A key : map.keySet()){   
             B val = map.get(key);
             System.out.println(key + ": " + val);
         }

  • Problem with Current row of a VO???

    I have a Advanced table region in which i add many rows..and i get the data in to it from the lov page (lov mappings).
    for each row i add... i have to set a item in main page table region doing some validations the data i get from lov region.
    with examples..more detailed..
    i have paymentAmount and AllocAmount...i get the payment Amount from LOV...after doing some validation on paymnetAmount i have to set the same value to the AllocAmount.
    ARTransactionLine is the VO which contains the above mentioned attributes....and advanced table i mentioned above is based on this VO.
    for this purpose im using the following code..
    ARTransactionLineVOImpl
    vo=(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.getCurrentRow();
    payment_amount = TransDetailsVORow.getPaymentAmount();/*for this paymentAmount i made a lov mapping..so that currentrow contains the value of paymnetAmount from lov page*/
    if(/* some validation*/){
    TransDetailsVORow.setAllocAmount(payment_amount);
    now when i do this ..for the first row it is working fine...but for the second row it is failing...getCurrentRow() is giving the values of previous row..not the current row...
    first of all what does this getCurrentRow return???
    help me ...n tell me where i was wrong...

    I m sure you have not gone through the tutorials completely.
    ARTransactionLineVOImpl vo =(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.getCurrentRow();
    with this row i am doing the below opeations..
    Number x=TransDetailsVORow.getPaymentAmount();
    /* some validations*/
    TransDetailsVORow.setAllocAmount(x);
    Change to
    ARTransactionLineVOImpl vo =(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.first();
    while (TransDetailsVORow!=null)
    Number x=TransDetailsVORow.getPaymentAmount();
    /* some validations*/
    TransDetailsVORow.setAllocAmount(x);
    TransDetailsVORow = (ARTransactionLineVORowImpl)vo.next();
    Tapash

  • What is the best way to store and iterate over lists of words?

    Hi,
    Im trying to create a naive bayesian classifier to attribute aurthorship to some texts. I have three text files in the form of a list of words (listA, listB and listC, where listA is a disputed text and listB, listC are those of known authors). I need to feed these into my program, than compare listA to listB (to check if listA has the same words as listB), perform the classification and do the same for listA and listC.
    Im new to java and would like to know the best way of comparing the text files....could i store listA in an array....listB in a hashmap, iterate over the hashmap to check which words are also contained in listA and store the similar words in a seperate arraylist?
    plz help.

    If you just want to check if one set of words contains another set of words then something implementing java.util.Set might be sufficient. Read the API docs, you don't need to write much code yourself. Maps are for looking up values based on keys; your problem statement doesn't mention that so you don't need them. Lists are for when the order of entries matters. Read this for more information:
    http://java.sun.com/docs/books/tutorial/collections/index.html

Maybe you are looking for

  • Set default image for no image found

    Hi Folks, I have a folder full of images and when en images is called form that directory and not found I would like the default image to show up. I have added an HTAccess file with this content: ErrorDocument 404 default.jpg And added a default.jpg

  • Junk file downloaded when port number and connection scheme is mismatched

    Hello All, I am facing a peculiar issue in my server running Apache Tomcat/5.5.9. I have a Tomcat server setup with 8080 and 8443 ports listening for http and https connections. When I access the tomcat welcome page hosted in my server as below, http

  • St02 performance problem

    Hi, in st02 in table generic key velue (DB access) always high. will it affect the performce of the server.if yes how to solve the problem help me out. below shows the value of the generic key in st02 Buffer         Swaps   Database                  

  • Extend both main and guest networks with a 2nd Time Capsule?

    I have a 4th generation 2TB Time Capsule set up to broadcast primary and guest networks.  I am running out of storage.  I would like to increase my storage and I would also like to extend both primary and guest networks. I currently use an older Link

  • How to find the parent package

    Hi, The problem I'm trying to solve is, given an instance of a SSIS package being executed, I need to find the GUID and execution id of the package that calls it. According to the API (https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.