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!
|
|
RecordChanges with Custom Mainview
Posted: 28 Aug 08 5:12 AM
|
On a custom mainview if you select RecordChanges it does create a History record which was a nice suprise. Of course there are no ID's populated so it does not apear in the Notes\History tab created for the new mainview. I have added an ID field for the new table to the History table and am looking for how others may have populated the value.
Looking at the global activity script now for a good place to update the newly created History record.
|
|
|
|
Re: RecordChanges with Custom Mainview
Posted: 28 Aug 08 9:15 AM
|
Here's what I ended up with:
1. Set a global in the onValidate event of each custom mainview with the ID Field and Value to update for any database changes. 2. Added an update in the Global Activity Application_AfterCreateHistory Sub to check if a global exists and if so update the newly created history record. 3. Clear the global in the mainview's onAfterPost event. |
|
|
|
Re: RecordChanges with Custom Mainview
Posted: 26 Feb 09 10:37 AM
|
I'm trying to do something like this myself, as I have created a new MainView to work with a new SERVICE table (not linked to a A/C/O)
I've put a popup in the global Application_AfterCreateHistory() function, and this pops up when I change something on Account or Contact, but not when I change something on my new form linked to Service. How do I make the method fire? I seem to be stuck at step 1 above, as I'm not sure what to put in the OnValidate event to make the global function fire.
Thanks,
Mark |
|
|
|
Re: RecordChanges with Custom Mainview
Posted: 26 Feb 09 10:43 AM
|
Did you enable the RecordChanges property on one or more of the fields on the form (and make a change to one of them to trigger the history creation?)
The global variable in the OnValidate just contains the ID for the custom entity so you can update the history record with the ID and then be able to see it one the Notes/Histoty tab you have created for your new entity. |
|
|
|
Re: RecordChanges with Custom Mainview
Posted: 26 Feb 09 10:48 AM
|
wow - quick :D
Yes, I have that set on all fields on the form, and made some changes.
(The form's BaseTable is bound to the SERVICE table, which has a primary key of SERVICEID, and I've added a SERVICEID to the HISTORY table.)
I wasn't sure what you meant by setting global variables on the form's OnValidate - so if that's necessary I've not done that either.
Is there another way to easily insert a HISTORY record? I suppose I could just insert a new record into the table myself, but that seems a little dangerous/uneccessary/anti-DRY/etc. |
|
|
|
Re: RecordChanges with Custom Mainview
Posted: 26 Feb 09 12:29 PM
|
I don't remember doing anything special to get the RecordChanges to work, I will try and take a look at that database and see if anything jumps out at me.
Hopefully you will not have to resort to cycling through all the fields to see which have changed and creating a history record manually, that would be a bit of a pain.
What version are you using? I am pretty sure the database I did this on was 7.2.2. |
|
|
|