Empty table and BO CurrentRowIndex exception


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Yep, this one's bitten me a bunch of time! Glad you got it figured out!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You got it.  Smile  The only time this error will occur is when a strong-type field property, custom or otherwise, is referenced and there are no records visible within the CurrentView (no records, filtered out, etc).  So as you discovered, if you test on the Count you will be able to safely reference the field properties.
Doug Birtell
Doug Birtell
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 33, Visits: 64
Greg,

Thanks for the clue.  It looks like the navigated event on the form was getting called first thing, and it was using a pk field form the primary business object (which is empty) to fill another BO.  I added a check to make sure that the cuurrent row index was > 0 before loading the other BO's and it all works fine now.

Regards,

Doug

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Well, the only way I know of that you'd get this exception is if you are referencing a field within the BO either in your form or in a fill method. I've run into this with custom properties that look up something based on the value of a field in the current row. I.e. I have a FK (in ID) to another table and I use a custom property to use this ID to look up the name of the item. I have to have code that checks on the CurrentRowIndex to make sure there is a current row or I get this exception.



Some more details (like the stack trace) would probably narrow this down really quick.
Doug Birtell
Doug Birtell
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 33, Visits: 64
All, (anybody)

When I run a SF maintenance form that uses a BO that references an empty table, I get the following exception.

The CurrentRow could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 0.  CurrentRowIndex: -1.

If I manually add a row to the table, then the app works fine.  Is there some way to check the CurrentRowIndex within the BO to keep the application from choking?  The table that this SF form maintains will always be empty to start with.

Thanks!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search