Handling Edits The SF Way


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Guys...great discussion...thank you!!

Let me see, then...to gather the widget on hand quantity I would run a query (in a view) that would do something like this:

Production table (get total of the widgets made) - Shipping table (get total of the widgets shipped) = Total OnHand Quantity

What about inventory counts when actual and on hand do not match?  How are those handled?  Inventory adjustment table?

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Bill,

I usually set it to be a single event for each property as Strataframe passes the field name in the event args. However I also have created my own event and event args and then raise the  custom event by adding the logic in the custom code section of the BO mapper.

For instance I handle events on reg and o.t. hours worked and pay rate fields with one event handler. in handling these events I can then recalculate gross pay whenver any of these fields change which in turn raises another event that calculates taxes and updates the check business object's value for withholding taxes etc. So in the Ui when a user changes something the event is raised and handled which then updates other values in other bound business objects causing all the bound controls to automatically refresh which makes things real real nice.

As Trent said views are great!! I write payroll software and in foxpro I keep running totals of week to date hours taxes garnishments etc and year to date hours etc in seperate tables, well these tables always seemed to get screwed up and I would have to run routines to recalc them. I now have all this type of logic in views so no more totals tables and the data is always accurate, so depending on what you need to do a view may be a better choice, hopefully this helps a little.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
All of these are great ideas...here is another idea that we use.  In fact, I am in the middle of creating some quanity on hand calculations for inventory items within our medical software.  We do not store the quantity on hand in the table at all.  This is better as a calculated field.  You can create a view, user-defined function, or stored procedure to get this amount for you dynamically.  This way it is ALWAYS right and you never have to worry about updating a field (which is the approach that we used in the past).

We have a transaction posting section for our inventory items that allows the end-user to post the purchase of new items, which in turn updates the tran table showing a quantity of X amount that has been added to inventory.  Then there is a transaction posting when the item is actually sold, which then would be a decrement of the QOH.  The view takes all of this into account and returns the value for me....this was a bit of an adjustment to our thinking at first, but has turned out to be MUCH faster, reduce errors, and be a better road to travel altogether.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Paul Chase (02/26/2008)
Bill,

I would say you could use the fieldchangedevent to accomplish this. In the bomapper under properties you can turn the generation of these events on. Once you turn on the event generation and rebuild your business object you can handle the event so whenever the field is changed in the main bo child business object is also updated. I use this in several places and it works great, also bound controls automatically update so it makes it very nice.

Paul

Interesting.  Should I set the Property Changed Event to "Unique Event for Each Property"?  Not sure how I could use this to my benefit...I would have to think about this one a bit.  Thanks for the tip.

Bill

Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Bill,

I would say you could use the fieldchangedevent to accomplish this. In the bomapper under properties you can turn the generation of these events on. Once you turn on the event generation and rebuild your business object you can handle the event so whenever the field is changed in the main bo child business object is also updated. I use this in several places and it works great, also bound controls automatically update so it makes it very nice.

Paul

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks, Peter!  Triggers do seem the best way.  Just wondering if there were any business layer methods to doing this.

The problem is that I currently do not have triggers on the DB objects.  If I add them, then the current application (which uses the sames tables) will have some difficulties.  Trying to mesh a couple of systems together with least amount of fallout is quite a touchy procedure.

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

Personally I would do all that kind of work using database triggers.

Cheers, Peter

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Here is the scenario that I need some input on:

A user enters the quantity of widgets that they produced.  They hit the save button.  The production data is stored in table separate from the widget table.  Once the user clicks save, I want the BO to update the On Hand total of the widget in the widget table.  I am thinking that I would place some code in the AfterSave() method to make this happen.  Here's the rub...what if the user entered the wrong quantity (not that this ever happens--I am just doing some just-in-case type of analysis here BigGrin Wink?  The user finds their production data entry and clicks edit, then proceeds to change the quantity and clicks save.  Now, what is the best way of handling this in order to update the widget table with the difference in quantity?

I have some ideas from previous non-SF days, but is there a good SF way to do this?

Thanks,
Bill 

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