Last post Dec 04, 2018 05:50 PM by wavemaster
Nov 27, 2018 07:31 PM|ASPnewbie751|LINK
So I am very new to this but I have an issue.
I need a wallboard of sorts that will display realtime information and update every 15 seconds or so. I have a SQL Query written that pretty much gives me what I need in a table but I need to split the results based on the status of the results and I am
wondering what is the best method to use.
I am terrible at explaining so I'll write an example.
If I were working for a construction company and wanted a web page that would show what workers are on the clock once they clock in. Their name would change color/location on the page if they are on break/lunch/meetings etc. The currently query I have gives
me everyone on the clock and their status. What method would you recommend for manipulating that data so I could present it?
Thanks in advance. Sorry this was a long post.
Nov 28, 2018 02:58 AM|Brando ZWZ|LINK
setinterval function to achieve your requirement.
Description and usge:
The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).
The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed.
The ID value returned by setInterval() is used as the parameter for the clearInterval() method.
Tip: 1000 ms = 1 second.
Tip: To execute a function only once, after a specified number of milliseconds, use the setTimeout() method.
I suggest you could use setinterval function to call a ajax function which will call the server's method to run the sql query to get the engineer status, then you could modify the page's element according to the ajax response data.
More details about how to use ajax to send the data to the server,you could refer to below article:
Dec 04, 2018 05:50 PM|wavemaster|LINK
Let's assume you have two tables:
A - aId, fname, lname,
B - bId, aId, timeStamp, some on the clock flag
The relationship is 1 to n: i.e. one worker has one or more records in table B.
select aId, fName, lName, the on the clock flag
from table a
LEFT JOIN table b ON a.aId =b.aId
WHERE timeStamp = today
You get a result for all workers, and some have the timeStamp, and the on the clock flag