Page 1 of 1

read from database dependent from time

Posted: Thu Jul 23, 2015 5:42 pm
by CharlotteMartin
Hi to all,

Is it possible to read from a database dependent from time?
I want to read a value from a database every 5 minutes. This should be repeated automatically,
the user should not have to click a button.
At the moment, it works when the user clicks a button. If the time is 15:30, like in the example below, and the User clicks the button, the first value from the database is displayed.
But I would like that the values are displayed automatically.
If I put the fuction call on openCard - nothing happens.

Here is my function. It is placed on the Card and I have a button on the card, where the function is called on mouseDown.

Code: Select all

local  tTime
local  tNumber
local tj
function databaseDisplayValues
   put getDatabaseID() into tDatabaseID
   set the twelveHourTime to false
   put the time into tTime
   put 1 into tNumber
   put 1 into tj
     
  if tTime = "15:30" then
      repeat while tj < 10
         put "SELECT WKAPower FROM wka WHERE wkaID = " &&  tNumber into tSQL
         put revDataFromQuery(tab,return,tDatabaseID,tSQL) into tRecords
         add 1 to tNumber
         return tRecords
      end repeat
   end if
   
end databaseDisplayValues

Maybe someone has an idea how I could implement that.

Best regards
Charlotte

Re: read from database dependent from time

Posted: Thu Jul 23, 2015 6:36 pm
by jmburnod
Hi Charlotte,
I want to read a value from a database every 5 minutes
It seems you have to write a "send in time message" also called "pendingmessages".
Have a look to "send" and "pendingmessages"
Best regards
Jean-Marc