﻿<?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 » Issues  » RestoreCurrentRowIndex And Undo</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:38:59 GMT</lastBuildDate><ttl>20</ttl><item><title>RestoreCurrentRowIndex And Undo</title><link>http://forum.strataframe.net/FindPost11079.aspx</link><description>I've run into an issue with RestoreCurrentRowIndex and Undo. In my application I have a business rule that checks for duplicates by looping through the records in the business object using move commands or GetEnumerable.&amp;nbsp;Before entering the loop I save off the current row index using SaveCurrentRowIndex. After the loop is completed I call RestoreCurrentRowIndex(False). At this point everything is okay. However if UndoCurrentRowOnly is called on the BO, the CurrentRowIndex is not updated and the Index&amp;nbsp;points beyond the current number of rows. Attached is a simple example that shows the issue. The BO is mapped to the SF demo data base although it doesn't access it.&lt;P&gt;I've been able to work around the issue by storing the CurrentRowIndex off to a local variable and restoring the current row using Move.Absolute.&lt;/P&gt;&lt;P&gt;-Larry</description><pubDate>Tue, 28 Aug 2007 09:28:02 GMT</pubDate><dc:creator>Larry Caylor</dc:creator></item><item><title>RE: RestoreCurrentRowIndex And Undo</title><link>http://forum.strataframe.net/FindPost11152.aspx</link><description>The reason that we clear the value is so that additional calls to RestoreCurrentRowIndex will do nothing after the first one that actually restores it.&amp;nbsp; There are a few places in code where RestoreCurrentRowIndex might be called more than once with only&amp;nbsp;one SaveCurrentRowIndex, but the index itself might have changed in between the calls to Restore, so we didn't want it changing the value again.</description><pubDate>Tue, 28 Aug 2007 09:28:02 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: RestoreCurrentRowIndex And Undo</title><link>http://forum.strataframe.net/FindPost11113.aspx</link><description>Actually after calling Undo(CurrentRowOnly) the CurrentRowIndex remains unchanged. Looking at the source for BusinessLayer I can see why this is happening. When Add() is called, BusinessLayer calls SaveCurrentRowIndex which sets the private variable&amp;nbsp; _SavedCurrentRowIndex to the current index. When RestoreCurrentRowIndex() is called it uses _SaveCurrentRowIndex to restore the CurrentRowIndex and then sets _SavedCurrentRowIndex to -1. When Undo is later called RestoreCurrentRowIndex does nothing since the value of _SavedCurrentRowIndex is -1. Since I haven't spent a lot of time looking at BusinessLayer I'm not clear on why _SavedCurrentRowIndex needs to be cleared when the current row index is restored, but not clearing it would fix this issue. &lt;P&gt;-Larry</description><pubDate>Mon, 27 Aug 2007 12:06:46 GMT</pubDate><dc:creator>Larry Caylor</dc:creator></item><item><title>RE: RestoreCurrentRowIndex And Undo</title><link>http://forum.strataframe.net/FindPost11097.aspx</link><description>Well, the Undo() method uses the SaveCurrentRowIndex and RestoreCurrentRowIndex internally, so after the call to Undo(), then "saved" current row index will most likely be -1, since that's the default and your save was wiped out.&amp;nbsp; So, in this case, I would probably recommend to just store it off manually.</description><pubDate>Mon, 27 Aug 2007 09:22:05 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>