Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clarion code - Get() returns ErrorCode() of 35 when a row is there 1

Status
Not open for further replies.

rleiman

Programmer
May 3, 2006
258
US
Hi Everyone,

Can you look at this code and tell me what I am doing wrong? I am trying to create a single row in the table only if that row is not already there. If it is there I wish to update the row.

ErrorCode() always return 35 even though the add statement adds the row in a previous call to this code.

Thanks.

Emad

Code:
! Calculate the weight to update or add.
!---------------------------------------

Clear (GoldAndScrapInStore)

If GOLD:Weight <> LOC:OriginalWeight |
Then
   LOC:WeightToUpdate = GOLD:Weight - LOC:OriginalWeight
Else
   LOC:WeightToUpdate = GOLD:Weight
End

! Update the in store gold weight.
!---------------------------------

Get (GoldAndScrapInStore, 1)

message (errorcode())

GoldScrap:TotalGoldWeight = GoldScrap:TotalGoldWeight + LOC:WeightToUpdate

If ErrorCode() |
Then
   Add (GoldAndScrapInStore)
Else
   Put (GoldAndScrapInStore)
End
 
Hi Emad,

GET(File, Pointer) does not work with TPS files. Do the following instead :

SET(File) ; NEXT(File)
IF ERRORCODE()
...
END

Regards
 
Hi ShankarJ,

Thanks for the help.

I hope they change it sometime to work. Is that a bug they are aware of?

I did find that if I created a key and did Get (File, key) it works.

Next time I will use Set (File) and Next (File)

Truly,
Emad
 
Hi Emad,

It is not a bug b'cos the internal record numbering is different in TPS. Actually one of the major changes done when I migrated from DAT files to TPS was to make sure all single record files were retrieved by a SET(File) ; NEXT(File) instead of GET(File, 1). Think positive, the SET() methodology will work on ALL database drivers including SQL ones.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top