Apply Server Changes


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Good afternoon!



If a user opens a window and searches for a specific record, then someone else does something to change that record, how could I retrieve those changes on the server and update the specific record? I'd like to attach this functionality to a button on the form so that the user can just check for changes whenever they need to.



Thanks!

Bill
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Bill,

I guess you will need some flag field to determine what records has been changed since the last search.



If you use the SF Concurrency feature, you could used a timestamp field which will be updated every time the record is being updated and include this field in your browsedialog search as a hidden field.

Edhy Rijo

Peter Jones
Peter Jones
Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)Advanced StrataFrame User (518 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Bill,



SF also has an automated RecordVersion number feature that you can also use. I say this because when I looked at this sometime ago I had a timestamp field in all my tables and was going to use it for concurrency but the SF guys recommended I use the RecordVersion number approach which I did and it has worked fine.



Cheers, Peter
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Pete just hit on a point that I was going to make in regards to using a Row Verison field.  I posted on another thread to automatically refresh a cache (which is one way)

http://forum.strataframe.net/FindPost23160.aspx

Or you can just rely on Concurrency.  By default SF supports OptimisticAllFields concurrency. But this can be slow.  It is recommended to setup a Row Version column for concurrency checking then SF will handle the rest in determining differences on the client and server side.  But if you want to automatically pull back a change from the server when one is made before you attempt to save your record, then you will need to implement the above link logic or implement Sql Query Notification Services.  I would recommend NOT using Query Notification Services if you can keep from it for a number of deployment issues that come into play.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
My solution was to add a small button to the right of the status. If the user clicks the button (and the BO's state is idle), then I fire this code:



mSalesOrders.Refresh("statusindex");



Since, for now, I only need that one field to update, I thought this would be the easiest approach. Any downsides here?



Bill
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
If it solves your problem, then no. Smile
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Just tested in the application...apparently, the code does not do what I thought it does. It does not go back to the server to retrieve the field's value and update the form. Bummer.



Back to square one.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You will have to go back to the server to update.  Again, I guess I don't understand why concurrency wouldn't work here.  This is the entire purpose of concurrency.  If there is a conflict update a save, the ConcurrencyException event on the BO will fire and you can address this on a field by field basis.  If you want to go back to the server before a save, then you will have to perform another query.  This is something that we have the ability within our medical application to do.  We have a refresh link within our pages for each maintenance program:

The Refresh Controls will requery any combo's etc.  This is not concurrency, though.  This is querying a lookup table.  If I understand you, you are trying to refresh the bound value.  In that instance, it would be concurrency.  The framework will already manage this for you to prevent a soft collision.  If you are going to try to hand code this for each field in your application, then it sounds like you are trying to side-step concurrency and make sure you have the most recent value from the server before you save.  In this case, you can just create a scalar method that retrieves that single value and updates your bound value.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I don't think I am side-stepping concurrency.



A sales user opens a BO (sales order) to review (not edit).

The status of the order is "Released".

The sales user leaves the window open on the desktop.

The shipping office creates a shipment which completed the order.

The status of the order is automatically changed to "Shipped".



Ideally, I would like to alert the user in real-time that the order was shipped, but I will settle for the user manually initiating the refresh of just the status field. Sure, I could re-query the whole BO, but I don't think it is necessary when only one field has been affected.



I decided to go with the ExecuteScalar route. I put together a small method in the BO that checks the current value against the value queried from the server. If the values differ, I update the BO's value and save (only if the BO's EditingState is idle). That seems to work fine.



Thanks,

Bill
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Ideally, I would like to alert the user in real-time that the order was shipped, but I will settle for the user manually initiating the refresh of just the status field. Sure, I could re-query the whole BO, but I don't think it is necessary when only one field has been affected.




In a previous post I mentioned using the row version in a scalar method to just query on a threaded timer to check for an update. This is something that we do in our medical software for check for updates in a real-time environment.



You can create a scalar method to check back with the server every 1-2 seconds to see if the status has changed. If so, notify the local client. You can also force the check prior to saving the record. This would prevent the need to have a button that checks the status.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search