tbcomputerguy Posted May 21, 2019 Posted May 21, 2019 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
comment Posted May 21, 2019 Posted May 21, 2019 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).
tbcomputerguy Posted May 21, 2019 Author Posted May 21, 2019 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
comment Posted May 21, 2019 Posted May 21, 2019 (edited) 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 From: https://www.smashingmagazine.com/2009/07/misunderstanding-markup-xhtml-2-comic-strip/ Edited May 21, 2019 by comment
tbcomputerguy Posted May 21, 2019 Author Posted May 21, 2019 (edited) 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 May 21, 2019 by tbcomputerguy
Recommended Posts
This topic is 2013 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