Jump to content
Server Maintenance This Week. ×

InstallOnTimer conundrum


This topic is 1802 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have this little app that uses google sheets as its base for the data.  When the app starts, it runs a script that downloads via insert from url a google sheet and stores it in a container field.  it parses it all out into fields etc.  As you can see in the pic, the bottom line in yellow shows the current dance.  done by comparing current time against another table via join.  This value is derived by a InsertOnTimer script that runs every 15 seconds and flushes the join to keep current dance value at the top.  My problem is, when there is a change in the spreadsheet (btw this is the clients choice of storage) I need another timer to run in the background that checks every 15 mins or so and notifies there is an update.  I have the update script working seamlessly..about 10 to 15 seconds for 810 records and 7 fields,  and can do this update manually as well from the preferences screen.  I can't for the life of me get the timer to run to check for updates.  I understand 1 window 1 timer.  I think it would be nice to notify the users of the change in data.  I have tried to used the push notification as well...again works but will not kick because one window one timer.  And I have read that the timers are windows based and not layout based..

So thanks in advance.  it is late here so if clarification is needed just say so.

Dave

FORFORUM.PNG

Link to comment
Share on other sites

Two possible solutions come to mind:

1.  Have your OnTimer script do one thing every 15 seconds, and two things every 15 minutes (or every 60th runtime). 

2. Use a web viewer for showing the current dance (will require some Javascript work).

Link to comment
Share on other sites

Ok thanks.  I believe the later of the two is beyond my skill level or at least i have not ever used java in filemaker or java at all for that matter.  the first I believe you are telling me to do a loop and then on the 60th run them both.  So my understanding is, you are saying I can run two timers in one script but not two independent timers in one window. Correct?  And could i not open a second window, move it to the background and run the update script.

Dave

Link to comment
Share on other sites

2 hours ago, tbcomputerguy said:

I believe you are telling me to do a loop and then on the 60th run them both

It's not exactly a loop. I meant keep a counter in a global field or variable, and when the counter gets to 60, do the other thing and reset the counter - something like (pseudocode, untested):

Perform Script [ "Script A" ]
Set Variable [ $$OnTimerCounter ; Valus: $$OnTimerCounter + 1 ]
If [ $$OnTimerCounter = 60 ]
  Perform Script [ "Script B" ]
  Set Variable [ $$OnTimerCounter ; 0 ]
End If
Install OnTimer Script ["This Script"; Interval: 15]

 

--
P.S.. Javascript is not Java. Two completely different things. And using Javascript in a web viewer is often convenient, esp. for tasks like this that involve a "live" ticking clock - see, for example:
https://fmforums.com/topic/71934-calculating-elapsed-time-realtime/?do=findComment&comment=340205

image.png.3276add294b65a553b9bbade6f23768d.png

From: https://www.smashingmagazine.com/2009/07/misunderstanding-markup-xhtml-2-comic-strip/

 

 

Edited by comment
Link to comment
Share on other sites

Sorry I mean javascript. Cute cartoon and the eggtimer file is quiet cool...i think that might come in handy.  I will have a go at this.  Sorry I had to edit this..just thought of something.  Would this be implemented with a script trigger attached to a layout or just attached to a button from the nave screen.

Thanks again

Dave

Edited by tbcomputerguy
Link to comment
Share on other sites

This topic is 1802 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.