cancel
Showing results for 
Search instead for 
Did you mean: 

Defaulting date to first day of the month (Syclo Agentry Workmanager 6.2)

0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Hi Bino,

Your first rule seems correct. Try the following rule once:

Regards,

Sahil Dudeja

0 Kudos

Hi Sahil,

I tried with the above rule but it's returning me the value 1/1/2001.

I guess the rule is getting corrupted somewhere. Do you have any inputs?

Regards,

Bino

Former Member
0 Kudos

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

Former Member
0 Kudos

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

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

Thanks Bill!

I have checked without the format string dd/MM/yyyy. I replaced 01 with 13 in rule & it showed 13th Jan on calendar.

Regards,

Sahil

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Interesting and not the behavior I expected.

--Bill

Former Member
0 Kudos

Agentry never fails to surprise me. I am using following rule:

This is what I see in Agentry Client:

Output is in format MM/dd/yyyy.

Regards,
Sahil Dudeja

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

What is your system regional setting?  Agentry should automatically convert dates to the local regional setting.  So if you system is set to MM/dd/yyyy it will display in that format.  If you are using dd/MM/yyyy you should see that displayed when using Agentry date and date/time fields.

--Bill