@Sangeeth
Hello,
yes i created a proprety(for exemple: Timer (text) that is watched by a declare expression(.Timer) and i used the legacy mode, just click on action and use legacy declare expression, and for my case i am basing my count on the pxCreateDateTime of the case:
This is the expression used by the declare expression:
((@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“m”))<10?“0”:“”)+@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“m”)))+“:”+((@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“s”))-@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“m”))*60<10?“0”:“”)+(@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“s”))-@round(@DateTime.DateTimeDifference(@CurrentDateTime(),@addToDate(.pxCreateDateTime,“0”,“0”,getDataSystemSetting(“Trial”,“ExamTime”),“0”),“m”))*60))
This is and explanation of the steps of this expression:
Minutes Calculation
a. @DateTime.DateTimeDifference(@CurrentDateTime(), @addToDate(.pxCreateDateTime, …), “m”)
What it does:
@CurrentDateTime(): Gets the current date and time.
.pxCreateDateTime: The start time of the session .
@addToDate(.pxCreateDateTime, “0”, “0”, getDataSystemSetting(“Trial”, “ExamTime”), “0”): Adds the exam duration (retrieved via getDataSystemSetting) to .pxCreateDateTime to calculate the end time.
@DateTime.DateTimeDifference(…): Calculates the difference between the current time and the end time in minutes (“m”).
b. @round(…)
What it does: Rounds the minute difference to the nearest whole number.
c. @round(… < 10 ? “0” : “”) + …
What it does: Formats single-digit minutes with a leading zero:
If the rounded minute value is less than 10, it prepends a “0”.
Otherwise, it leaves the value as is.
Seconds Calculation
a. @DateTime.DateTimeDifference(@CurrentDateTime(), @addToDate(…), “s”)
What it does: Similar to the minutes calculation, but it calculates the difference in seconds (“s”).
b. - @round(@DateTime.DateTimeDifference(…, “m”)) * 60
What it does: Converts the minute part back into seconds (minutes × 60) and subtracts it from the total seconds. This gives the remaining seconds.
c. … < 10 ? “0” : “” + …
What it does: Formats single-digit seconds with a leading zero:
If the remaining seconds are less than 10, it prepends a “0”.
Otherwise, it leaves the value as is.
And then you can call the proprety Timer on your section to get your timer.