Timer Extension

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
ketut
Posts: 10
Joined: 01 Aug 2017, 12:42

Timer Extension

Post by ketut »

Hi all,

I wanna setup time so that it move like "watch". I try to use Timer Extension, but it fails. how to do that?

Best regards

Ketut
Attachments
timer.png
timer.png (2.59 KiB) Viewed 6954 times
User avatar
jeanmichel
Posts: 109
Joined: 23 May 2014, 11:37
Location: Sydney

Re: Timer Extension

Post by jeanmichel »

Hi Ketut,

It will not be possible to query the date from the server every second. The easiest option is to read the date field by identifying it and naming it. You can then use the timer extension to +1 sec every second. So it's not the real time but it should be the same as on the server ....
Our recommendation implementing the above is following:

Name the date field as init_time.

Set the timer tick interval to 1000 (1 sec) and then put code below to ontick property

var stf = FIELDS('init_time');
var s = stf.getProperty('value');
console.log('from: input:' + s);
if ( !AXES._sdate ) {
AXES._sdate = new Date(s);
AXES._edate = new Date(AXES._sdate.valueOf() + 1000);
} else {
AXES._edate = new Date(AXES._edate.valueOf() + 1000);
}
var n = AXES._edate.toLocaleDateString()+ ' ' + AXES._edate.toLocaleTimeString();
console.log( n );
stf.setProperty('value',n);
stf.refresh();

here a reference for javascript date function if he need more date information. https://www.w3schools.com/jsref/jsref_obj_date.asp
Regards,

Jean-Michel Rapin

LANSA Pty Ltd
email: JeanMichel.Rapin@lansa.com.au
Address: 122 Arthur Street, North Sydney, NSW 2060, Australia
Tel: +61 289 070 262 http://www.lansa.com | http://blog.lansa.com |
ketut
Posts: 10
Joined: 01 Aug 2017, 12:42

Re: Timer Extension

Post by ketut »

Hi JM

is timer extension put directly to date field or I should add user field first?

regards
Ketut
User avatar
jeanmichel
Posts: 109
Joined: 23 May 2014, 11:37
Location: Sydney

Re: Timer Extension

Post by jeanmichel »

Hi Ketut,

You should add a user field first.
Regards,

Jean-Michel Rapin

LANSA Pty Ltd
email: JeanMichel.Rapin@lansa.com.au
Address: 122 Arthur Street, North Sydney, NSW 2060, Australia
Tel: +61 289 070 262 http://www.lansa.com | http://blog.lansa.com |
Post Reply