Error 35 record changed by another station

So I haven’t seen this in a while. I added two different browses to my screen for two different files, one salesfile and one rental file. The items on the salesfile can be created by the rental file… this all works. However, when I’m looping through the sales file when I’m completing the transaction (to create an invoice), I added some simple code that updates the records in the rental file. Everything was fine until then, then I started getting the changed by another station error for the rental file after I went back to the start of the browse screen. I guess a buffer isn’t getting updated and I tried about everything. Here is the code.. by the way it’s C11 ABC..

adjustRentals       ROUTINE
  !it is a rental record
  ren:refID=SAL:renRefID
  if access:rental.tryfetch(ren:refID_Key)
    message('Rental: ' & SAL:renRefID & ' Not found!')
    EXIT
  .
  !update the record for the next month
  !just always zero out the deposits in the rental because it's a one time thing.
    ren:deposit_amt=0
    ren:deposit_ID=0
  !.
  ren:last_processed_date=today()
  ren:last_processed_time=clock()
  !calculate new bill date and time separately from next process date
  do calcNextBillDate
  if access:rental.tryupdate()
    message('Could not update Rental Record!')
  .
   !BRW15.UpdateBuffer()
   !BRW15.ResetFromFile()
   !BRW15.PostNewSelection()
   !BRW15.UpdateViewRecord()  
  EXIT

As you can see I tried about everything.. none of it worked. Calcnextbilldate just changes to fields.. so I didn’t list it here.
I would appreciate any help or hints here… Thanks, Ray

Have you tried to use Alias Tables to do the work on?

1 Like

No. That could be an option of last resort I guess. It’s strange, I can update the salesfile from the rental file with no problems, but I update the rental file from the salesfile and I get this error. For context, I’m looping through the salesfile then if it was created by the rental file, then I change that record in the rental file. It should have been a simple thing. I know this is the code because when I don’t use it, everything is fine. I manipulate other files all the time from the same screens, but this one is just being a real PITA.

Whats the backend db?

topspeed is the rental file, salesfile is a clarion.dat file. Most of my files are clarion.dat files. I have small files that are topspeed. The salesfile and rental file are not related, but the rental file is a child file of my inventory file (a .dat file). I could change the rental file to a .dat file as I’ve never published this version of the software.. if you think that is it?

I’m asking questions of chatGPT. In one possible solution, it said to use the Access:Rental.UnUseFile(), then process the rental record, then Access:Rental.UseFile()

I’ve never heard of UnUseFile(). Anybody else heard of that?

chatGPT has me trying all sorts of things. It’s on the right track, but nothing works. I did discover the reason for the error 35 is because the browse is by customerID, processDate key, and I’m changing processDate. If I don’t change that one variable, everything is fine. Unfortunately it’s a pretty important variable because it sets up the next processing date for recurring billing. So I could get rid of the double key, or just keep hacking at this thing. I kind of need it to be in processDate order so I guess I’ll keep hacking. How fun. Now it’s just a challenge. I’ve tried updating the view record, the buffer.. all sorts of things after I successfully change the rental record. I even tried putting that field in the reset fields list hoping the templates would take care of it. Nope. So any other idea’s, I’d appreciate it.
ChatGPT has lots of idea’s. It even makes up code objects that don’t exist. At least it apologizes when I call it out.

chatGPT makes things up and calls it real. Hooray. Then it writes the imaginary code for you. There are certain things you can do to prime the session to cut the phoney baloney down to a minimum and get better results. Lyra is one https://www.reddit.com/r/ChatGPT/comments/1lnfcnt/after_147_failed_chatgpt_prompts_i_had_a/

But tell make sure you tell it not to invent syntax that it doesn’t know to exist in Clarion.

It sounds like the process you’re using to update the Rental file is doing a PUT, or Access:Rental.Update() so when whatever Form procedure you are using tries to save your changes it re-reads the Rental record from disk to see if it has changed and gives you the error, to let you know that it has.

I guess you can either not update the Rental record in the other process, or maybe call …

IF ThisWindow.PrimeUpdate() <> Level:Benign  ! Reload the record from disk 
  MESSAGE('Ooops','Ooops')
END

…after that process and before you save the Rental record with your Form procedure. Note that this re-reads the record from disk and updates the buffer that the save process uses to check if it changed. It also overrides any other changes you have made in the form, and doesn’t show them to you.

There is probably a more elegant way to do it?

Your subject says “Error 35” which is “Record not found” which can happen on a GET or FETCH.

Error “changed by another station” is Error 89, that can happen on a PUT. So there is some confusing info in your post? I’m also not clear where in your code posted you are getting the error?

AFAIK the only way you can get Error 89 “changed by another station” is if a WATCH(File) was done before the GET. The Browse does that Watch and Regret(view) before calling the Form so on Put the Form can tell the user the record was changed by another.

You can check if Watch is active with File{PROP:Watched}. That may be useful to know to figure this out.

To turn Off the Watch you will need to Fetch/Get the record again without a preceding Watch. ,So try doing that before starting.


One other idea is to remove the ABC calls and use Clarion GET,PUT,etc so you are sure to see ERRORCODE() and ERROR(). And sure exactly what code is executing. At the top should do access:rental.UseFile() to be sure it’s open.

1 Like

Yeah, the error is strange. It is a record retrieval error screen. It says: This record was changed by another station. Error: (Record not found (35)) attempting to access a record from the rental file.
This is not really a form. It is a window. At the top I select a customer, then the browse becomes filtered (range) by that customer#. There are 2 different tabs, each one browsing a different file, but both are filtered by the loc:custID. I do a lot of different things on this screen. I can process the rentals from the rental browse, create sales records.. everything works great. Then it creates an actual invoice, saves it, then the cleanup removes the sales records, and during that process it updates the rental records to be ready for the next time. It fails because the browse for the rentals is by the customer ID key, a double key, customerID, processDate. If I don’t change the process date in the routine, I have no problem. If I change it, it all actually works fine, until I reset the screen back to selecting the customer for the browse. That’s when I get the record not found error. I know it has to do with the key changing because the processDate is part of the key. I tried telling the template to not put the primary key in the view, and that didn’t help. I think I need to update the view buffer after I save the record that updates the processDate. But I haven’t got that to work. The error is happening when I reselect a new customer for the browse. Maybe I need to figure out how to completely kill the browse part and reinitialize it.
Thanks for taking a look.
Next step is I’ll create a video. Not sure if I can upload video’s to this forum, but I’ll check into it.

OK, at the end of your procedure, try …

CLEAR(Cus:Record)
Cus:CustomerID = SavedCustomerID
Cus:ProcessDate = WhateverTheProcessDateNowIs
Access:Customer.Fetch(Cus:CustomerIDKey)  ! If that's the key name?

…I think the problem is your browse is trying to refresh by the last accessed record and because you’ve changed the key values the browse can’t find it. The above code will reset the customer to the one the browse needs. (At least I think that’s what you need?)

Tried it.. I think what I need to do is basically reset the entire screen. If I exit the screen and go back in it’s fine. So I did this after everything:

resetRentalBrowse   ROUTINE !to try and prevent the record not found error
  !workaround was to close and restart the entire screen
  !stop(loc:cust_num & ' at resetRentalBrowse')
  if DidARental
    DidARental=false
    !stop('Going to reset entire screen!')
    post(EVENT:CloseWindow)
    start(pos_screen,25000)
  .

It’ll have to do for now.. it’s a workaround, not a solution. But I want to finish the rental portion of the Point of sale so I can start using it for our company, and our customers can start using it. I’m going to use it for our monthly subscriptions, and our customers can use it for monthly storage fee’s, or any monthly fee’s that are on recurring charges. Later I’ll add other time ranges for any kind of rentals. Thanks for the help. I’ll refer to it later when I try again to figure how to reset the entire browse.

ChatGPT finally helped with a solution. I had the same problem in another area. Turns out I was deleting records and on the last one I guess the browse couldn’t sync and got the record changed by another station and record not found error.

So, at the end of my loop of deleting records…

  FREE(BRW15.Q)
  BRW15.ResetFromFile()
  DISPLAY

I think I had tried the resetfromfile… but I didn’t free the Q…
That did it. Thanks to everyone for your help.