Thanks. I think that gives me a good direction in how to address it. I just will need to add an event catch that changes the state to dirty if the state changes.
> On Nov 12, 2019, at 5:20 PM, Tom Benedict <[email protected]> wrote: > > Hi Eric, > > If I understand your question correctly, I think you’re looking for a “dirty” > flag. As far as I know there is no built in function that track this, so > you’ll need to create your own. > > Below are the three methods I use to track the state of a Write Pro object. > It was inspired by help I received on forums.4d.fr <http://forums.4d.fr/>. > > — Create an object in the On Load event of a Write Pro object call: > > // Method: WP_InitInformation > // ---------------------------------------------------- > // User name (OS): Tom Benedict > // Date and time: 9/5/2019, 10:28:45 > // ---------------------------------------------------- > // Description > // bld277005 > // > > C_OBJECT(WP_Information) > > If (OB Is defined(WP_Information)) // already exists > WP_Information.IsNewDocument:=False > Else > WP_Information:=New object("IsNewDocument";False) > End if > > If (OB Get type(WP_Information;"DocumentInfo")=Is undefined) // doesn't > already exists > WP_Information.DocumentInfo:=New > object("FilePath";"";"Modification";False) > Else > // do nothing > End if > > — Update the object whenever the Write Pro document is modified (like in the > On Data Change event of a Write Pro object): > > // Method: WP_Information_SetModified([isModified]) > // ---------------------------------------------------- > // User name (OS): Tom Benedict > // Date and time: 9/5/2019, 11:07:29 > // ---------------------------------------------------- > // Description > // Set the Modification Property of WP_Information object > // See WP_Information_Init > // bld277005 > // > > C_BOOLEAN($1) > > C_OBJECT(WP_Information) // this object is initialized in WP_Information_Init > > If (Count parameters>0) > $isModified:=$1 > Else > $isModified:=True // default > End if > > WP_Information.DocumentInfo.Modification:=$isModified > > — Test the state wherever/whenever you wish with: > > // Method: WP_Information_isModified -> isModified > // ---------------------------------------------------- > // User name (OS): Tom Benedict > // Date and time: 9/5/2019, 11:07:29 > // ---------------------------------------------------- > // Description > // Get the Modification Property of WP_Information object > // See WP_Information_Init > // bld277005 > // > > C_OBJECT(WP_Information) > C_BOOLEAN($0) > > $0:=(WP_Information.DocumentInfo.Modification=True) > > HTH, > > Tom Benedict > >> On Nov 12, 2019, at 14:07, Eric Naujock via 4D_Tech <[email protected] >> <mailto:[email protected]>> wrote: >> >> I have a series of records and want to detect whether the 4D Write Pro >> object has been changed since it was loaded. This way I can keep a version >> archive of older versions of a document available. Is there an easy way I’m >> not seeing to know if the Write pro object has been changed since it was >> created or loaded. Right now I al creating a Write Pro object since 17R4 had >> an issues with saving rite Pro objects to a record in a client-server >> situation. Though I think it may have been fixed in R5 or R6. >> >> The Write pro object is created when the case is loaded as a free standing >> object since the object odes not reside in the main record table. Its lives >> in a large object table nearby since not all records have the Write Pro >> object in it. >> >> Or is there a way to have an object change detecting in an event that would >> tell me there was a change in the object and that it needs to have the old >> object saved to the History table. >> ***** > ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

