anbu bose Posted December 7, 2013 Share Posted December 7, 2013 Dear Friends, In my scenario, I have one process with timer starter activity. When timer starts the activity, I need to assign one variable (process or shared variable, i don't know which one will be suitable) value as 1. Again If I starts the process second time, the same variable must be updated as 2. If I run the process another time, the same variable must be update as 3, like its goes on up to 24hours of the starter activity. After 24hrs if I run the process , it must update variable as 1. How do we achieve that. Kindly help on this. ThanksBose Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted December 8, 2013 Share Posted December 8, 2013 Thanks Nicolas. I am going to implement with simple modifications. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted December 9, 2013 Share Posted December 9, 2013 Hi Bose, Is your requirement like if u r starting the timer at 5 AM, then the variable should be 5 or it should start from 1. Thanks, Anand Link to comment Share on other sites More sharing options...
Nicolas Heitz Posted October 23, 2015 Share Posted October 23, 2015 Hi Bose, The attached project should address your scenario. You can adjust the timer's frequency to your needs. Note that in case the engine stops, the "time difference" state will be lost. If this is a problem for you, you can use a file to keep track of the last state of the variable. Hope this helps. Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted October 23, 2015 Share Posted October 23, 2015 you can pick hours from current-dateTime() -- using the function: 'tib:get-hours-from-dateTime'. this returns the hours in 24HR clock format --Vaibhav Sethi Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted October 23, 2015 Share Posted October 23, 2015 Keep bumping the SharedVariable by 1 when timer wakes up, and while consuming the value from sharedVarialbe.... perform a modular division (1 mod 24 =1, 23 mod 24= 23, 24 mod 24 = 0, 47 mod 24=23, 48 mod 24 = 0, and so on).... this will keep resulting value always between 0 and 24 no matter how many years it run. Refer to this link for mod division --> http://www.miniwebtool.com/modulo-calculator/ Link to comment Share on other sites More sharing options...
Ben Amiot Posted October 23, 2015 Share Posted October 23, 2015 Just some consideration on all that: 1) This approach will not work if you have 2 engines running (might not be an issue if it's a timer). 2) As someone mentioned, this approach will not work if your engine dies. Overall, I'm wondering if you could use the engine stats to for that and reset the counter after 24h of run. Link to comment Share on other sites More sharing options...
Gloria Tyler Posted August 5, 2020 Share Posted August 5, 2020 Also try to check thisModulo Calculator Link to comment Share on other sites More sharing options...
Recommended Posts
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