Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
I have a simple task that I am struggling with. We could work around it, but I'd like to automate as much as possible for my users in an effort to make it easier for them. I have a workflow that has a variable for them to enter a date. I want to be able to add 4 years to that date by using an expression robot and assign it to another variable. In my mind it seems like a simple task that I keep getting syntax errors for when I attempt my solution. I was wondering if anybody had done this before or if anybody could provide any insight on how to get this to work smoothly. Thanks.
Date now = new Date(System.currentTimeMillis());
Keep gmt offsets in mind if you're passing dates to and from the methodserver.
I don't know if wfexpressions know about java.util by default. You may have to use full classnames.
Also, I recommend not putting this stuff inside your expression. Instead, call another class that does this work. Later, if you decide you don't want to add four years, you can just return the date as is. Or if you decide you want to add five years, you could change that easily.
//wfvariable Timestamp requiredDate
//inside your transition/expression
{
requiredDate = com.custom.wfexpr.UpdateRequiredDate.update(requiredDate);
}
public class UpdateRequiredDate {
}
I see you worked with Dates in windchill. Maybe you've got an idea concerning my problem defined here: http://communities.ptc.com/thread/35822
I'ld like to have a calendar picker for the date variables in activities of my workflows.
Thanks if you can help.