[Migrated from the Syclo Resource Center]
JPabich 12/13/2011 11:49,
I have a String property of an object that can contain a timestamp value (12/13/2011 1:15:32 PM). I want to be able to take this string value, convert it to a date/time and add a designated number of hours to the time. I have a rule set up to do this, but converting the string timestamp to DATE_AND_TIME always returns a value of 0. I can't change the property to be of date/time because this property is not always a timestamp. Are there any other ways to try to calculate this?
Jason Latko 12/13/2011 14:43
Add a designated number of hours and then store the result where?
In what context are you using your rule?
Also, please post a screen shot of your rule.Jason Latko (Senior Product Developer at Syclo)
JPabich 12/13/2011 15:24
I am trying to use this as an update rule to populate either a string field or a date/time field. How do I post a screen shot?
My rule is very simple.
SUM
DATE_AND_TIME
PARAMETER_VALUE property retrieved with a search rule on an object
86400
Without the SUM and DATE_AND_TIME, just retrieving the PARAMETER_VALUE property returns the correct value and populates correctly in the string field, but not a DATE/TIME field. Adding the DATE_AND_TIME function to convert the PARAMETER_VALUE to a timestamp puts an incorrect value in both the string and date/time fields. Adding the SUM function in also puts an incorrect value into the fields. The date/time field is blank and the string field reads 12:00:01 AM.
JPabich 12/20/2011 10:17
I am still having trouble creating a rule to handle a date/time value that is originally stored as a string.
I want to take a start time that is stored as a string property
actual value of: 12/29/2011 7:51:03 AM and add 55 hours to it and display it in either a string or a date/time field.
No matter how I try to manipulate it, it always comes back as 1/1/2001 12:00:00
AM.
Any suggestions?Thanks,Jenny
Jason Latko 12/20/2011 10:28
Jenny,Sorry for the delay.
I will look at this for you today and post a solution.Jason Latko (Senior Product Developer at Syclo)
JPabich 12/20/2011 15:31
Thanks.
What I would really love to do is to have a property that contains a date and a property that contains a forumla such as START_TIME+10-5 and be able to through a rule execute this calculation to populate a second property called COMPLETE_TIME.
I haven't found any way to do such a thing in Agentry.
Is this possible?
Jason Latko 12/20/2011 15:34
Yes,Date/time math is possible in rules, as Agentry treats these property types under the hood as large integers that can be added to/subtracted from.
Sorry but I have been tied up today.
I'll get a solution up shortly.Jason Latko (Senior Product Developer at Syclo)
Jason Latko 12/20/2011 17:29
Jenny,I am having a hard time finding a way to convert a string date/time "12/25/2011 03:10:20 PM" to an Agentry date/time through a rule.
I'm starting to think it can't easily be done, but will continue to dig.
An Agentry developer just verified that he thinks it isn't possible either.
Why do you need to work with strings as the origin date/time?
If you use a DateTime property to begin with, you can do your math and then easily format and display as a string using the Format Tokens of the DATE_AND_TIME rule function.Attached is a working example I just tested that starts with a DateTime property screen field (called DateTime) and adds 1 day to it (86400 seconds) before formatting it using the Format Tokens.
This rule is attached to a String screen field as an Update Rule.I am going to request a new rule function that takes a formatted String Date, Time, or DateTime and converts it to the Agentry equivalent.
This would make date and time calculations and manipulations much easier.
Jason Latko (Senior Product Developer at Syclo)
JPabich 12/21/2011 09:32
Thanks Jason!
I was hoping to not have to maintain two sets of data for this. We were storing the date as a string because the property itself was generic and dependent on user entry. It could be string, number, date/time. I think it would be helpful if in a future release it would support converting a string date/timestamp into an Agentry DATE_TIME value.