﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Empty table and BO CurrentRowIndex exception</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 10:19:17 GMT</lastBuildDate><ttl>20</ttl><item><title>Empty table and BO CurrentRowIndex exception</title><link>http://forum.strataframe.net/FindPost11368.aspx</link><description>All, (anybody)&lt;/P&gt;&lt;P&gt;When I run a SF maintenance form that uses a BO that references an empty table, I get the following exception.&lt;/P&gt;&lt;P&gt;The CurrentRow could not be evaluated because the CurrentRowIndex is out of range.&amp;nbsp; Business object record count: 0.&amp;nbsp; CurrentRowIndex: -1.&lt;/P&gt;&lt;P&gt;If I manually add a row to the table, then the app works fine.&amp;nbsp; Is there some way to check the CurrentRowIndex within the BO to keep the application from choking?&amp;nbsp; The table that this SF form maintains will always be empty to start with.&lt;/P&gt;&lt;P&gt;Thanks!</description><pubDate>Fri, 07 Sep 2007 16:46:07 GMT</pubDate><dc:creator>Doug Birtell</dc:creator></item><item><title>RE: Empty table and BO CurrentRowIndex exception</title><link>http://forum.strataframe.net/FindPost11388.aspx</link><description>Yep, this one's bitten me a bunch of time!  Glad you got it figured out!</description><pubDate>Fri, 07 Sep 2007 16:46:07 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Empty table and BO CurrentRowIndex exception</title><link>http://forum.strataframe.net/FindPost11374.aspx</link><description>You got it.&amp;nbsp; :)&amp;nbsp; 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).&amp;nbsp; So as you discovered, if you test on the Count you will be able to safely reference the field properties.</description><pubDate>Thu, 06 Sep 2007 14:18:51 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Empty table and BO CurrentRowIndex exception</title><link>http://forum.strataframe.net/FindPost11373.aspx</link><description>Greg,&lt;/P&gt;&lt;P&gt;Thanks for the clue.&amp;nbsp; 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.&amp;nbsp; I added a check to make sure that the cuurrent row index was &amp;gt; 0 before loading the other BO's and it all works fine now.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Doug</description><pubDate>Thu, 06 Sep 2007 13:42:10 GMT</pubDate><dc:creator>Doug Birtell</dc:creator></item><item><title>RE: Empty table and BO CurrentRowIndex exception</title><link>http://forum.strataframe.net/FindPost11371.aspx</link><description>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.&lt;br&gt;
&lt;br&gt;
Some more details (like the stack trace) would probably narrow this down really quick.</description><pubDate>Thu, 06 Sep 2007 11:55:42 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>