2 Replies Latest reply on Apr 29, 2010 5:21 PM by user8860348

    Code Error: Invalid row number 1 for class RowSet method GetRow PCPC:67


      Hello. I am writing PeopleCode to manipulate data in Level1 Scroll Bar. My Component has 4 pages and its Structure is as follows:

      Scroll - Level0

      Scroll - Level1 Primary Record JournalLine1

      While JournalLine1 is inside of the page JournalLine and its fields are "Account" and "Amount". The field in the page "JournalTotal" is "TotalAmount". My job is to add up all numbers in "Amount" field of "JournalLine1" and assign the total amount to the field "TotalAmount" of the page "JournalTotal". My PeopleCode is as follows:

      Local RowSet &RS;
      Local Row &row, &total;
      Local Record &rec;
      Local Field &field;

      &RS = GetLevel0()(2).GetRowSet(Scroll.JournalLine1); /* JournalLine is on the 2nd on level 0 */
      &row = &RS.GetRow(1); /* only one row "JournalLine1" on level 1 */

      For &I=1 to &row.RecordCount
      &rec = &row.GetRecord(&I);
      &field.Value = &field.Value + &rec.GetField(Field.Amount).Value;

      &total = GetLevel0()(3); /* JournalTotal is on the 3rd on level 0 */

      &total.GetRecord(Record.JournalTotal).GetField(Field.TotalAmount).Value = &field.Value;

      The above PeopleCode is compiled. But when I run the component in Browser, I got such an error:

      "Invalid row number 1 for class RowSet method GetRow PCPC:67. Component.GBL.JournalLine1.Amount.FieldChange. A PeopleCode program has called an object method with an invalid value for the row number parameter. The row number should be within the range of existing rows in the RowSet."

      I think this error is referred to " &row = &RS.GetRow(1);" Because there is only one row "JournalLine1" on level 1, it seems correct to use GetRow(1). I have also tried "GetRow(0)" and "GetRow(2)", but got the same error.

      Why does "&row = &RS.GetRow(1);" get such an error ? Can any folks help to solve the problem ?

      Thanks in advance.