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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This record was changed or deleted by another station - not on network

Status
Not open for further replies.

emaduddeen

Programmer
Mar 22, 2007
184
US
Hi Everyone.

I get a false message: This record was changed or deleted by another station

I am not using a network and have only one instance of my app running.

I believe the problem is becase of my use in a put statement in my code.

In the "after file open" embed is this code from an update procedure:
Code:
! Set up defaults.
!-----------------

CASE ThisWindow.Request
   OF InsertRecord
      ! Adjust the new catatory number.
      !--------------------------------
      CAT:Category = INV:Category

      Get (Categories, CAT:KeyCategory)

      INV:CategoryNumber = CAT:CategoryNumber + 1
      INV:Markup = CAT:Markup
      INV:MaxDiscount = CAT:MaxDiscount

      Display()
End

In the "after insert" embed of a browse I have this code:
Code:
! Update the category with the new catatory number.
!--------------------------------------------------
If GlobalResponse = RequestCompleted |
Then
   CAT:Category = INV:Category

   Get (Categories, CAT:KeyCategory)

   CAT:CategoryNumber = INV:CategoryNumber

   Put (Categories)
END

I think I am using the wrong statements here. In the app I add a row into the inventory table. Then some code updates a number that increments by 1 or more. This code stores that changed number into the catetories table. If I keep the browse window open and click on the change button or the insert button, etc I get the "This record was changed or deleted by another station" message. If I close the window and re-open it I can change or insert, etc ok.

Please tell me what is wrong with the code.

Thanks.
Emad
 
Hi Emad,

Change the embed to use WM.PrimeFields (before Parent call) instead of WM.Init.

Regards
 
Hi ShankarJ,

Thanks for the reply.

I moved the code in the update procedure to WM.PrimeFields (before Parent call) and still have the issue. The code that increments the number still works but when it hits the code in the "after insert" embed causes everything not to work whenever I try to call the update procedure. That is when the update procedure lookup procedure get statement fails.

Maybe something needs to be cleared after issuing the put statement in the browse procedure upon return from inserting. I know things get cleared when closing and re-opening the browse procedure window.

Thanks.
Emad
 
Hi Emad,

If you want to do something on a return from a Form the correct embed is BrowseObject.ResetFromAsk OR in the WM.Run (you have to find the correct embed for that by using the SOURCE option in embeditor).

Regards
 
Hi ShankarJ,

I was using "after insert" since the embed name was easy to figure out.

If I use the BrowseObject.ResetFromAsk embed can you tell me how to code to see if the form was called as an insert?

Thanks.
Emad
 
Hi Emad,

After Parent Call :

IF Request = InsertRecord AND Response = RequestCompleted
...
END

Regards
 
Hi ShankarJ,

I looked at the source code and found that the "after insert" is in the same area as "BrowseObject.ResetFromAsk".

I think something just needs to be reset and the program will allow me to insert, and change but I don't know what code to use.

Thanks.
Emad
 
Hi Emad,

Where are you getting the error - in the Browse or the Form?
The error message you mention will come only if it fails a concurrency check i.e. saved buffer is not equal to buffer contents on disk for the record. Have you tried resetting the browse after you update i.e. BrowseObject.ResetQueue( Reset:Queue )? What database are you using? Is there an Unique identifier i.e. making each row in the browse unique like a Primary Key, in the displayed browse columns or hot fields. This is very important for SQL databases.

Regards

 
Hi ShankarJ,

I will try the BrowseObject.ResetQueue. I am also using topspeed tables.

Here is the sequence of what happens:

User is on the category browse and selects a category. Next the user switches to another tab which is the inventory browse. This is where the "after insert" embed has the code to put into the table.

The user clicks the insert button to call the update inventory procedure. In this procedure the category number part of the sku is incremented and displayed to the user. The sku is a category followed by a numeric value.

When focus returns to the inventory browse the "after insert" code runs. All is ok up to this point.

The user goes to either change, delete, or insert another inventory item. This is when the error message is displayed.

I will try the BrowseObject.ResetQueue code to see if it clears out what needs to be cleared.

Thanks.
Emad
 
Hi ShankarJ,

I just tried the new code but I still get the error message.

Here is the code so far:

Code:
! Update the category with the new catatory number.
!--------------------------------------------------
If GlobalResponse = RequestCompleted |
Then
   CAT:Category = INV:Category

   Get (Categories, CAT:KeyCategory)

   CAT:CategoryNumber = INV:CategoryNumber

   Put (Categories)

   ! Show the search result in the list.
   !------------------------------------
  ! BrowseCategories.ResetFromBuffer()
   BrowseCategories.ResetQueue(Queue:Browse:1)
END

I guess you can see I also tried ResetFromBuffer() but that did not work as well.

The error message is on the category table.

Truly,
Emad
 
Hi Emad,

Is the Category Table OPEN in the Browse and the Form? And, why cannot you update the next number of the categories File in the Form's WM.TakeCompleted - after parent call which is the correct place for secondary updates. The code should be :

IF NOT ReturnValue ! no error in updating form's main table
IF SELF.Request = InsertRecord
....
END
END

Check for errors after the PUT().

Regards
 
Hi ShankarJ,

I moved the code to the form to the new place. Everything updates ok but I still get the same error message unless I close the browse and re-open it.

Here is the new code in the form's "WM.TakeCompleted - after parent call" embed.

Code:
 Update the category table with the last used category number.
!--------------------------------------------------------------
IF NOT ReturnValue   ! no error in updating form's main table
   IF SELF.Request = InsertRecord |
   Then
      CAT:CategoryNumber = INV:CategoryNumber

      Put (Categories)

      If Error() |
      Then
         Message ('Could not save data in the category table.', 'Error')
      Else
         Message ('New Inventory has been recorded.', 'Update')
      End
   END
END

This one seems to be a real tricky one to solve.

Thanks.

Truly,
Emad
 
Hi Emad,

First, retrieve the Categories Row/Record again and update it i.e. GET() .. PUT() as the values could have changed.

You have not answered my question on the UNIQUEness of the browse row.

Regards
 
Hi ShankarJ,

The browse is on a unique key using the category column and the CategoryNumber column.

I tried this:

Code:
! Update the category table with the last used category number.
!--------------------------------------------------------------
IF NOT ReturnValue   ! no error in updating form's main table
   IF SELF.Request = InsertRecord |
   Then
      CAT:Category = INV:Category

      Get (Categories, CAT:KeyCategory)

      CAT:CategoryNumber = INV:CategoryNumber

      Put (Categories)

      If Error() |
      Then
         Message ('Could not save data in the category table.', 'Error')
      Else
         Message ('New Inventory has been recorded.', 'Update')
      End
   END
END

And I tried this:
Code:
! Update the category table with the last used category number.
!--------------------------------------------------------------
IF NOT ReturnValue   ! no error in updating form's main table
   IF SELF.Request = InsertRecord |
   Then
      CAT:CategoryNumber = INV:CategoryNumber

      Put (Categories)

      CAT:Category = INV:Category

      Get (Categories, CAT:KeyCategory)

      If Error() |
      Then
         Message ('Could not save data in the category table.', 'Error')
      Else
         Message ('New Inventory has been recorded.', 'Update')
      End
   END
END

but still get the error.

Can I post the souce code from the procedure here if you have time to look at it?

I appreciate all of the time and attention you have been devoting to my issue. I still have a lot to learn about Clarion, but I also love the product and will always stay with it.

I noticed that after the error is displayed, I can still continue inserting and changing but each time the errors is displayed unless I close the window first.

Thanks.

Truly,
Emad
 
Hi Emad,

It's time you use the debugger and step through your code and see at which statement the error is thrown. This will give you an idea of the problem.

And, the correct way is :

CLEAR(CAT:Record)
CAT:Category = INV:Category
GET (Categories, CAT:KeyCategory)
IF ERRORCODE() |
...
ELSE
CAT:CategoryNumber = INV:CategoryNumber

PUT (Categories)
IF ERRORCODE()
...
END
END

Regards
 
Hi ShankarJ,

I used the code with the clear statement but still get the error.

I did discover that the error is actually comming from the browse procedure and not the update one. It comes right before the calling of the update procedure if the insert, update, or delete button is chosen.

Before trying out the debugger I displayed messages in the embed points to make sure they were not causing the error.

I also tried the debugger but so many other procedures and functions are called that it seemed to take forever to actually get back to the browse procedure while stepping through the code.

Can I post the module source because I am very new to the clarion language if most of the module source is confusing except for the embed code I placed into the module.

Thanks.

Truly,
Emad
 
Hi Emad,

The module source will be too big to post. Also, if you have not identified the statement on which the error is reported, the source will not help.

Regards
 
Hi ShankarJ,

Since I can't identify the statement that is causing the problem I think I will re-create the browse to see if anything I am doing is creating the problem. I will rename the original browse and take parts from it to see if that is causing the problem.

Thanks for taking as much time as you could for trying to solve our issue.

Truly,
Emad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top