Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: ph_modifytimedevent Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 19 2009 at 01:18 | IP Logged Quote mike0999

I apologize for another question, but I for the life of me cannot get the ph_modifytimedevent command to work. I am using ph2.1b. I have tried many different variations of the command, and every time I get a "syntax error."

For example, the following gives me a syntax error:

ph_modifytimedevent("RECYCLEDAY",1,datetime(January 1, 2010),2)

I definitely have a timed event named "RECYCLEDAY" defined. It is defined to execute a tts formula that says "today is recycle day." Very simple, and I confirmed that that command works.

Running the forgoing ph_modifytimedevent command returns an exclamation point. I have tried the name RECYCLEDAY both with and without quotes; I've used the string command, with RECYCLEDAY in parentheses.

I have used both 1 and 0 in the next field.

I have used a date in the format that Dave used at this post.

http://www.myx10.com/forum/forum_posts.asp?TID=2229&PN=1

I used each of 1, 2 and 4 in the last field. In fact, I also tried 3, 5, 6 and 7 in the last field because the command online help seems to suggest adding up values for that field.

I have tried to add a space before the first parentheses. I have tried adding spaces after each comma. I have tried adding spaces before and after the quotes around the term RECYCLEDAY.

Everything I have tried returns a syntax error. Would greatly appreciate any help. I am pulling my hair out. Seems there must be something simple I am overlooking.

Thanks!
Back to Top View mike0999's Profile Search for other posts by mike0999
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 19 2009 at 07:30 | IP Logged Quote TonyNo

Dave's example was this...

ph_modifytimedevent("WATERHEATOFF",0,2009-06-03 20:00:00,4)

Your datetime() needs a time and a tweak to the format.

Try...

ph_modifytimedevent("RECYCLEDAY",1,2010-01-01 20:00:00,2)

You need to set the last parameter depending on what you are updating.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 27 2009 at 02:48 | IP Logged Quote mike0999

Thanks a lot Tony. That does in fact work.

Still not exactly sure what I did wrong, as I thought I had tried that format. Maybe I did leave the date off.

Either way, thanks again.
Back to Top View mike0999's Profile Search for other posts by mike0999
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 29 2009 at 01:24 | IP Logged Quote mike0999

Follow up question. I am trying to enable RECYCLEDAY and set the reftime to today's date at 7PM.

I have tried the following formula:

ph_modifytimedevent("RECYCLEDAY",1,datetime(date(datetime(to day())),19:00:00),4)

I know that the datetime formula works if I do it as a separate formula to give me "today's" date at 7PM.

If I change the last digit to a 2, the formula also works to "enable" recycle day. I have also tried 6, 1, 3 and 5 in the last field and they all tell me that the formula is evaluating to 2. I also get the following syntax error:

Syntax Error in Formula: Time(ph_relativedatetime(time(1900-01-01 00:00:00.000),999*30))

Any thoughts? I apologize, I am struggling so much with this.

I suspect that maybe this has something to do with "recalculating" the start time, but just not sure.

Thanks in advance for any help.
Back to Top View mike0999's Profile Search for other posts by mike0999
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 29 2009 at 01:42 | IP Logged Quote mike0999

Hmm. Looks like this might happen because the start time in the timed event is already later than the ref time that I am trying to set.

I'll have to dig to see if there is a way to modify a start time so that it is earlier than a currently set start time.
Back to Top View mike0999's Profile Search for other posts by mike0999
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 29 2009 at 04:03 | IP Logged Quote mike0999

Figured out a different way to achieve my goal.

Looks like I might be able to directly modify the sql database to change a start time for a timed event, though.

This program is really cool. Amazing flexibility - very well thought out.


Back to Top View mike0999's Profile Search for other posts by mike0999
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 29 2009 at 07:39 | IP Logged Quote TonyNo

Focusing on your example...

datetime( date( datetime( today())),19:00:00)

...can be simplified to...

datetime( date( today()), 19:00:00)

Digging deeper...

Why would you need to change the start time of RECYCLEDAY programmatically?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 30 2009 at 02:00 | IP Logged Quote mike0999

Thanks again Tony.

On the start time, you may be right, it may be unlikely that I'd ever need to modify it programmatically.

In this particular case, it was only because I was seeing the error I described above when I was trying to test a modified formula for a timed event. I.e. I was changing the formula for a timed event and wanted the updated timed event to execute earlier than a start datetime that had previously been set for a week from now. Obviously all it would take is a new timed event, which is easy enough. But, I suppose I was being curious as to whether or not it could be done.

I get the sense that you may be driving at something I may not understand, though. So, don't hesitate to elaborate. Definitely always looking to learn. E.g. maybe your point is that the start datetime is always set as the current datetime when the timed event is created and it is automatically updated when the timed event is run. I.e. if the timed event is defined properly, it shouldn't need to be adjusted?

Thanks for your help.

Mike
Back to Top View mike0999's Profile Search for other posts by mike0999
 
mike0999
Groupie
Groupie


Joined: June 14 2009
Location: United States
Online Status: Offline
Posts: 56
Posted: June 30 2009 at 02:05 | IP Logged Quote mike0999

The ph_modifytimedevent does seem intended to update the start datetime. But, it doesn't seem to work to set it to an earlier start datetime than a start datetime that may already have been established (unless I was doing something else wrong).
Back to Top View mike0999's Profile Search for other posts by mike0999
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 30 2009 at 08:15 | IP Logged Quote TonyNo

mike0999 wrote:
...it doesn't seem to work to set it to an earlier start datetime than a start datetime that may already have been established (unless I was doing something else wrong).

Dave may need to chime in on that.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum