Objects are at it again, continuing to demonstrate their utility to ease your life as a developer.
Using time (or duration) values inside of objects is now smoother and more intuitive. Beginning with 4D v17, times inside objects are set as seconds – and not milliseconds!
OB SET ($myObject;"myTime";$time;is time)
$time:=OB Get ($myObject;"myTime";is time)
Now, this constant is no longer mandatory. The code above can be shortened, but even more importantly, object notation can be used as well!
TIME IN OTHER CONTEXTS
QUERYING OBJECT FIELDS
- From now on, when querying an object field with QUERY BY ATTRIBUTE, comparisons between number and a time values are performed in seconds instead of milliseconds.
Here are two examples which produce the same result:
QUERY BY ATTRIBUTE([Table_1];[Table_1]z;"time";"=";?12:00:00?)
QUERY BY ATTRIBUTE([Table_1];[Table_1]z;"time";"=";12*60*60)
- $4d bridge
COMPATIBILITY CAN BE MAINTAINED EASiLY
If necessary for existing databases, this default setting can be changed with the SET DATABASE PARAMETER command and the Times inside objects selector.
There are two available values for this option:
- Times in milliseconds
- Times in seconds
This database parameter is applied to the database itself, not just the current process. To maintain compatibility or help the migration process, this command can be called during the On Startup Database Method.