read from database dependent from time

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
CharlotteMartin
Posts: 1
Joined: Thu May 28, 2015 12:05 pm

read from database dependent from time

Post by CharlotteMartin » Thu Jul 23, 2015 5:42 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: read from database dependent from time

Post by jmburnod » Thu Jul 23, 2015 6:36 pm

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
https://alternatic.ch

Post Reply