11/30/2024 6:35:41 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
|
|
|
|
Grid Inline Edit calculations and DB update.
Posted: 06 Nov 07 1:09 PM
|
Have a databound grid where you can edit the cells. When I change the cell I can fire off event EditingRow to figure out the ID and new value (so you can use Editing to trap the old value and not do anything if they didn't change the value.....).
I can go after the recordset to get the field values......perform calculations.....etc.
So how do I store the data? I have an UPDATE SQL statement already, and it works.....but it fires off an error message about the current row not being correct (like maybe SLX is trying to store the single field value that was changed.....).
When do I run the SQL statement? |
|
|
|
Re: Grid Inline Edit calculations and DB update.
Posted: 07 Nov 07 3:46 PM
|
It seems like you are trying to do the same thing that is done on the Opportunity Products grid, and there is a method called CommitChanges in the code behind the form that saves the update to the database. It creates an updatable recordset and saves it that way. It's called from the Edited event instead of the Editing event, though, which might be what you are looking for. The procedure in there is to do the calculations, commit the changes to the database, update the sales potential, reselect the row you just made the change on, and then refresh the view (with some other error checking and currency formating in there as well).
Was that what you were looking for, or am I up in the night? |
|
|
|
Re: Grid Inline Edit calculations and DB update.
Posted: 07 Nov 07 4:19 PM
|
It turns out that SLX has changed the way they do an update statement.....Optimistic Locking. The have changed the WHERE clause to go after both the RowID (OPPPRODUCTID) and the OldValue of the field that you inline edited.....so if you changed the Discount from 5 to 10% it would look for a discount of .05 AND the correct OPPPRODUCTID.....
Except when you do a bunch of calculations off of the change you have to write the stuff to the database (UPDATE OPPORTUNITY_PRODUCT SET.....)....like CommitChanges (except this is a live datagrid, not a disconnected recordset grid like in the SLX Opp Products stuff). So if you update the discount to 10%, the SLX Update statement for your inline field edit can't find the Record (since the old value was 5%!).
So I'm back up and running in 7.2 with inline grid edits....but it took a half a day to get it right!
THANKS! |
|
|
|
Re: Grid Inline Edit calculations and DB update.
Posted: 07 Nov 07 4:29 PM
|
You know, a little voice in my head said, "Don't bother trying to help - he knows more about this then you do." So I guess this time I was crazy for NOT listening to the voices in my head
But you're welcome. It's good you can catch those things. |
|
|
| |
|
Re: Grid Inline Edit calculations and DB update.
Posted: 03 Jan 08 10:10 AM
|
A good example of this is the "Manage Product" form. The datagrid on this form has a column called "Status" that is a combo box. To set up a combo box column, set up the datagrid and add all your columns through the SQL property. Next, open up the columns property, right-select the column you want to be a combo box, and click "Change Column Type..." Select either the combo type or the picklist type (they both end up being combo boxes). Then click "Ok," right-select again the column you are working on, and choose "Properties..." The lower half of the popup window is where you'll set the rest of the properties of the combo box, such as what you want to see in the listed items, how many items you want to see, etc.
|
|
|
|
Re: Grid Inline Edit calculations and DB update.
Posted: 03 Jan 08 10:36 AM
|
Jeff, Thanks. I just looked at that form. Yes, its very helpful, I now see how its done. An interesting way of avoiding fully defining all methods in a higher dialog. I'll give it a try. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|