Last Modified Date Time Attribute property

Official Content
This documentation is valid for:
Indicates the DateTime based attribute that contains the information on when the record was last modified.

Description

This attribute will be used as a reference for timestamp algorithm to determine which rows must be synchronized from the server to the device. In other words, the device will synchronize those rows which have its last modified date time higher than the last synchronization timestamp.

On the next synchronization, the server has the timestamp sent by the device, so it uses this timestamp to compare with the value in the Last Modified Date Time Attribute. All rows modified or added after the last synchronization are considered.

Run-time/Design-time

This property applies only at design-time.

Samples

Suppose we have a Chat transaction object defined as follows.

Sample_1_Model_png

As you have noticed, we have set the following properties (both are required for using synchronization by timestamp).

Suppose there are two friends communicating with our chat system and they already have the following rows synchronized on their devices.

friend1   friend2   10/12/17 12:00:01 AM    False   Happy birthday!
friend2  friend1  10/12/17 12:00:02 AM  False  Thks =) See you tomorrow at the dance club?
friend1  friend2  10/13/17 12:05:47 AM  False  Mom ¬¬ I'm fine. Write u later. Bye


Minutes later, the friend1 realizes that has made a mistake sending a message to friend2 instead to Mom. Hopefully, our chat system allows the end user to change the content of sent messages, and the friend1 decides to modify the text with "Hey dude! I'm on the dance club. Where r u?".

Typically, the developer implements this functionality by using New command (not recommended) or combining Business Component Load method with Commit command in a Procedure as follows.

parm(in:&From, in:&To, &DateTime, in:&Text);

&Chat.Load(&From,&To,&DateTime)
&Chat.ChatMessage = &Text // instanciated with 'Hey dude! I'm on the dance club. Where r u?"'
&Chat.Save()
commit

Then, the developer expects that this new row on the Chat table will reflect the change automatically on the target device after the insertion. But, in synchronization by timestamp, due the last message is already synchronized on the friend2 device, the updated row will never be sent (there is no hash comparison). Therefore, the appropriate mechanism for updating (or inserting) data is the full responsibility of the developer. In such case, the Procedure exposed before should be changed for the following code.

&Chat.Load(&From,&To,&DateTime) 
&Chat.ChatMessage = &Text   // instanciated with 'Hey dude! I'm on the dance club. Where r u?"'
&Chat.ChatTimestamp = now() // Last update modified (value 10/13/17 12:06:17 AM)
&Chat.Save() 
commit

Once the row has been updated by the developer, both devices will have the following records on its offline database (luck for friend1).

friend1   friend2   10/12/17 12:00:01 AM    False   Happy birthday!
friend2  friend1  10/12/17 12:00:02 AM  False  Thks =) See you tomorrow at the dance club?
friend1 friend2  10/13/17 12:06:17 AM  False  Hey dude! I'm on the dance club. Where r u?

How to apply changes

To apply changes made by this property, do a Re-Build All.

Availability

This property is available since GeneXus 15 Upgrade 8.

Scope

Objects: Transaction
Platforms: Smart Devices(Android, IOS)

See Also

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.