Subject Re: [IBO] Tying down the cursor with TIBO Dataset and D5 Pro
Author Tony Masefield
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 12:30 PM 3/10/2005 +0000, you wrote:
> >Hi All,
> >
> >I have a simple DB grid attached to a TIBO Query/TIBO Database.
The
> >TIBO_DB is set to autocommit.
> >The idea is simply that the 'operator' enters rows of data (it's a
> >data logging application), hitting the down arrow key to 'scroll'
down
> >to the next vacant row for the next round of input.
> >However, when hitting the down arrow key after filling in a row,
the
> >cursor jumps back up the grid.
> >Any ideas how to stop this happening?
>
> Are you using Autocommit? and/or an ORDER BY clause in your SQL?
>
Yes, am using autocommit. Also using an Order By clause plus a WHERE
to link this query to a master query through the DataSource property
of the query (Where X = :X). Could this be the problem??

> What's the CommitAction of the dataset?
>
Think I've tried them all but to no avail. Have looked for an
explanation of CommitAction but haven't found(?). Any references?

> >I would have used bookmarks but
> >I read somewhere they don't work (at least well? think it was in
one
> >of JW's 'white papers').
>
> Adding new records to the end of a set should behave like Append
(I
> think!), unless you have something in your setup that's forcing
the dataset
> to reorder itself each time you move past EOF. You shouldn't need
to resort
> to bookmarks in a repetitive data entry task.
>
> >Perhaps I have a setting wrong (quite possible) but also maybe
there
> >is a trick to it with TIBO (also quite possible).
>
>
> >Tried using QRY...Last late last night (actually very early
morning)
> >in AfterPost but encountered an error of an access violation (from
> >memory that was the error but it was late).
>
> I don't know what you mean by "tried using QRY in AfterPost". Can
you explain?
>
Actually it's QueryWhatever.Last - i.e. using the TIBOQuery Last
property in the query AfterPost event. Sorry, I see that the
description was 'messy'.

> Helen

Have a similar app (i.e. an MDI application with child forms used
for logging data specific to equipment) on my laptop at work which
displayed the same problem. However in this case I had a
Query.Refresh in the Query.AfterPost and no Datasource link.
Removing the Refresh solved the problem (i.e. one can enter records
in sequence as I wish) but there is no Refresh in the app I'm
talking about.
The second application had a PK which was based on a TimeStamp and I
had used Refresh to update this field as well as a 'logged_by' field
(he who logs the data - it's a 24 by 7 shift operation). Both fields
were set as the default values for the fields in the table (i.e. Now
and User_Name respectively) hence leaving blank fields in the grid
was not a real option. I resorted to setting both fields
programmatically (by using NOW and TIBO_Database.UserName in the
query OnNewRecord Event) which resolved the problem - I know, I
would rather rely on the server to designate the current DateTime,
but couldn't figure a way around the refresh problem re-setting the
curser.

Doing some further 'investigations' on the app I'm developing at
home (the one I started discussing) I noticed that the cursor was
going to the top of the grid so I expanded the grid vertically to
see what would happen (thinking that it may be grid related). the
cursor after hitting the down key then went back around 10 records,
not to the top of the grid as I expected (there's about 20 or so
dummy records).

Sorry for the length of this post.

Thanks for the help HeLen.

Rgds,
Tony