Access last created record

BadSector

New Member
Hi,

I have :
assignValues.html
Code:
[B][FONT=Arial][FONT=Arial]define new shared variable tempreqnum like bytesbrd.reqnum.[/FONT][/FONT][/B][FONT=Arial]
 
[B][FONT=Arial]create BytesBRD.[/FONT][/B]
[B][FONT=Arial]Assign ReqNum = tempreqnum. /*tempreqnum increments[/FONT][/B]
[B][FONT=Arial]Assign Benefits = get-value("Benefit").[/FONT][/B]
[B][FONT=Arial]Assign BRDReceived = "NO".[/FONT][/B]
[B][FONT=Arial][B].[/B][/FONT]
[FONT=Arial][B].[/B][/FONT]
[FONT=Arial]RUN value("sendEmail.html").[/FONT]
[/B][/FONT]

sendEmail.html
Code:
[B][FONT=Arial][FONT=Arial]define shared variable tempreqnum like bytesbrd.reqnum.[/FONT][/FONT][/B][FONT=Arial]
[B][FONT=Arial]find first bytesbrd where reqnum = tempreqnum NO-LOCK.[/FONT][/B]
[/FONT]

The program fails on the find clause. If I hardcode the tempreqnum to be tempreqnum-1 then it works fine.
I’ve checked the BytesBRD and the records are created.
So it seems the CREATE creates the record with reqnum e.g. 12, but then the FIND can only find up to the 11th record (Even if I use FIND LAST bytesbrd).


After running the app I get this in the log :
S-0003>(Apr 11, 2007 08:56:03:857) [34992] ** FIND FIRST/LAST failed for table BytesBRD. (565)
Or if run without the FIRST option :
S-0003>(Apr 11, 2007 08:58:17:015) [34992] ** No BytesBRD record is available. (91)

Please help! I need to be able to refference the last created record.
 

Casper

ProgressTalk.com Moderator
Staff member
Maybe dirty reads? Did you start broker with -rereadnolock parameter? If not, try to do so. This should solve the problem.

casper.
 

YOSANTO

New Member
You need to be able to refference the last created record?

in ur assignValues.html
---------------------------------
create BytesBRD.
Assign ReqNum = tempreqnum. /*tempreqnum increments
Assign Benefits = get-value("Benefit").
Assign BRDReceived = "NO".
.
.
RUN value("sendEmail.html?reqnum=`tempreqnum`").

then in ur sendEmail.html
----------------------------------
def var ireqnum as integer.

assign ireqnum = integer(get-value("regnum") no-error.

find first bytesbrd where reqnum = ireqnum NO-LOCK.


may be u can get ur last record. :)
 

BadSector

New Member
Thanks for the reply!

My problem wasn't passing the # of the last created record to the next procedure ( shared variables work fine ) but rather the "FIND" bit.

It seems that there isn't enough time between a CREATE and FIND for the last record to be commited to the DB. (I think, no, I know I'm wrong here)

I did manage to work around it though, but I can't remember how! Something crazy no doubt.
 
Top