Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Know is the current record is the first record
Wed, Jan 7 2009 8:41 AMPermanent Link

ASSOES
Hi

Are any form to know is the current record is the first record ?
I try Bof, but this property is set to true only when I go to the prior record and the
current record is already the first record.
RecNo don't return 1 (for the first record) if is the dataset is filtered.

Regards
Robert
Wed, Jan 7 2009 8:49 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

<< Are any form to know is the current record is the first record ?  I try
Bof, but this property is set to true only when I go to the prior record and
the current record is already the first record. RecNo don't return 1 (for
the first record) if is the dataset is filtered. >>

That is the only way to know if you're actually on the first row - save the
bookmark for the current row, try a Prior and check BOF, and then set the
row pointer to the saved bookmark.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jan 7 2009 12:11 PMPermanent Link

ASSOES
Hi Tim

<< That is the only way to know if you're actually on the first row - save the
bookmark for the current row, try a Prior and check BOF, and then set the
row pointer to the saved bookmark. >>

OK; but if the Table is in Edit or Insert Mode ?

Regards
Robert
Wed, Jan 7 2009 12:49 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

ASSOES


The other way of doing it is to have a separate copy of the table open then when you want to check do secondcopy.first and simply compare their primary keys.

Roy Lambert [Team Elevate]
Thu, Jan 8 2009 7:36 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Robert,

<< OK; but if the Table is in Edit or Insert Mode ? >>

Well, with Inserts there is no way of knowing until you Post the record, and
with Edits you can only know if you're not modifying any of the fields that
make up the active index fields.

Can I ask for some background info on what it is that you're trying to
accomplish ?  There may be a better or easier way to get what you want.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jan 8 2009 11:09 AMPermanent Link

ASSOES
Hi Tim

<< Can I ask for some background info on what it is that you're trying to
accomplish ?  There may be a better or easier way to get what you want. >>

I need to know if the current record is the first record, because the table has two
calculated fields, and the operation, for calculate this fields, is different if is the
first record or other record.
And when the table is in a grid, the first record must be paint in a color different than
the others records.

Regards
Robert
Thu, Jan 8 2009 11:54 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

ASSOES


When you say calculated fields do you mean the values are calculated and stored or are you using OnCalcfFields?

If the former then I think you have a problem since what is the first record can change with user input and you'd have to recalculate so I hope its the second.

Assuming it OnCalcFields then what you need to do is roughly what I said before. Using tables and assuming a integer primary key field named ID:

1. drop another TDBISAMTable on the form (say call  it Checker) pointing at the same table
2. in OnCalcFields do the following

Checker.First;
if CheckerID.AsInteger = realtableID.AsInteger
then do first record calculation
else do non first record calculation;



Roy Lambert [Team Elevate]
Fri, Jan 9 2009 2:38 AMPermanent Link

ASSOES
Hi

I'm using OnCalcFields, and thanks to your help I Solve It.

Thanks Tim & Roy
Image