on 01-18-2016 9:31 AM
Hi experts,
I am working on Workmanager 6.2.
While adding labour time, I want to set the default date as the first day of the current month in date field. (for eg. for the month of January, it should be 1/1/2016).
I tried adding a rule in the initial value but it's not working.
There are two rules that I tried, but it's not working.
1.
The logic I tried is hard coding day to 01 and then concatenating it with System month and year.
2.
The logic I tried was ---- System Date - (System Date - 1 day)
Please help me on this.
Regards,
Bino
Bino,
Your first example is the right path but instead of specifying a blank argument for the DATE_AND_TIME in the CONCATENATE you should use DATE. Also if you only want the current date then use DATE instead of DATE_AND_TIME in both places.
--Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bino,
January 1, 2001 is agentry's epoch value. DATE_AND_TIME expects first parameter of type DATE, DATE AND TIME or TIME to return correct date. Since you are using CONCATENATE function which returns String, it expects date and time to be in the format hh:mm:ss MM/dd/yyyy.
I would suggest change first string in rule as 00:00:00 01/ and then check.
Regards,
Sahil Dudeja
Hi Bino,
As suggested by Bill, DATE function can be used instead of DATE_AND_TIME function because you require DATE as output of Rule. Following rule worked for me:
Note: 1. Replace 01 in above rule with a Global. Using hard coded values in rules is not considered as good programming practice.
2. If this rule is used in String context, then date will be displayed in dd/MM/yyyy format. Otherwise Format string will be ignored and date will be displayed in MM/dd/yyyy
Regards,
Sahil Dudeja
Sahil,
In your rule you need to either change the order of your concatenate terms for fix your last format string to match the order of your values. You are concatenating in MM/dd/yyyy but converting back to a date with dd/MM/yyyy. It happens to work because your month and day are both 1 right now but next month you will get Jan 2nd 2016 when this rule executes.
--Bill
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.