Peter Barfield Posted November 17, 2015 Posted November 17, 2015 Hi Guys, I have a web viewer which is simply a clock. I have looked over the forum for the solution but can not seem to get my head around where to retrieve what I want which is - the current time sent to a variable.From what i can gather - you have to use a left, middle etc in a calc to return the value ( or thats what i am assuming) my issue is where and how?. Here is the detail inside my webViewer: "data:text/html, <html> <head> <script language='javascript' type='text/javascript'> function displayClock() { var digital = new Date(); var hours = digital.getHours(); var minutes = digital.getMinutes(); var seconds = digital.getSeconds(); var amOrPm = 'AM'; if (hours > 11) amOrPm = 'PM'; if (hours > 12) hours = hours - 12; if (hours == 0) hours = 12; if (minutes <= 9) minutes = '0' + minutes; if (seconds <= 9) seconds = '0' + seconds; dispTime = '<b>'+hours + ':' + minutes + ':' + seconds + ' ' + amOrPm+'</b>'; document.getElementById('time').innerHTML = dispTime; setTimeout('displayClock()', 1000); } </script> </head> This returns nicely on the screen as the correct time. If I use the GetLayoutAttribute content i get the above show up in a test dialog box. What I want is the result of the above i.e. the time. Any ideas on where the calc should be looking for the result? cheers
comment Posted November 18, 2015 Posted November 18, 2015 9 minutes ago, Peter Barfield said: where to retrieve what I want which is - the current time sent to a variable. Why don't you simply use the Get ( CurrentTime ) function, which gets the current time directly from the system clock, without needing a web viewer.
Peter Barfield Posted November 18, 2015 Author Posted November 18, 2015 Comment that is a fair question and usually that would be the case however, in this instance 4 Terminals will be in use and for audit and session consistency this way in my thinking appears more accurate. If one of the terminals which are being used has an incorrect time then it wont marry up with the others or worse still if heaven forbid they were all running on different time then that would be disastrous. Hope this makes sense and I hope i am understanding the use of Get(CurrentTime) Function as returning the time as specified on the current machine. Thus the web viewer option to be "universal amongst all machines". Cheers,
comment Posted November 18, 2015 Posted November 18, 2015 (edited) 6 hours ago, Peter Barfield said: I hope i am understanding the use of Get(CurrentTime) Function as returning the time as specified on the current machine. Yes, it does. And so does your clock in the web viewer. 6 hours ago, Peter Barfield said: in this instance 4 Terminals will be in use and for audit and session consistency this way in my thinking appears more accurate. If one of the terminals which are being used has an incorrect time then it wont marry up with the others I am not sure what you mean by "terminals". If your solution is hosted, you can use Get ( CurrentHostTimeStamp ) to get the host's timestamp. If not, you'll have to get the clock from some external source - perhaps by importing it from a web service or inserting it from a URL. Edited November 18, 2015 by comment
Peter Barfield Posted November 18, 2015 Author Posted November 18, 2015 OK so I have misunderstood the clock issue by the looks of it. I assumed that the time in the web viewer was from a URL. As that is what the instructions I had at hand implied. (it's a good day as I have learnt something new). Yes it will be hosted and at that point you would be correct I could use the Get ( CurrentHostTimeStamp ) i actually had missed that as an option in the functions and thus thought it was only relevant to the current machine. Think I will turn to the right and head down that path you have pointed me in. Thanks for the clarity much appreciated.
comment Posted November 18, 2015 Posted November 18, 2015 (edited) 2 hours ago, Peter Barfield said: it's a good day as I have learnt something new That's my motto, too (under different spelling, though ). This, BTW, is an excellent example of the XY problem. Edited November 18, 2015 by comment 1
LaRetta Posted November 18, 2015 Posted November 18, 2015 I have taken some of these wrong paths myself. Excellent link, Comment. :-)
Peter Barfield Posted November 19, 2015 Author Posted November 19, 2015 Thanks comment. Fantastic link had a chuckle to myself as yes sometimes I am so guilty of not taking the foot off the pedal and standing back and reassessing the problem or situation my wife also say's i am guilty of just assuming that what is going around in my head should be going around in everyones head and so I often don't explain myself because of said assumption.- I just try to plough on like a bull at a gate. It's just my pig headedness to not lose at anything that does it. Albeit, yes I often lose much to my disgust. :-) Thanks for the "gentle reminder" appreciated. Cheers
Recommended Posts
This topic is 3383 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now