Discussion


RuleTek
US
Last activity: 4 Oct 2018 13:54 EDT
How do I use function @DateTime.TimeDifferenceBusinessDays?
I'm using Pega 7.1.9. I can't figure out how to use function @DateTime.TimeDifferenceBusinessDays(aCalendar,strStart,nDays,nHours,nMinutes,nSeconds) in a data transform. The first parameter seems to be the problem. The pop-up documentation says I can pass null to use the server's default calendar and time zone, which would be fine -- but if I enter null or an empty string ("") or leave the parameter off altogether, I get various syntax errors. How can I create a CalendarObject for that first parameter?
Here are the syntax errors I'm getting:
@DateTime.TimeDifferenceBusinessDays(null,"20160607T134400.000GMT",5,0,0,0)
Invalid expression or reference: No suitable instance found
[seeking]
@(null:DateTime).TimeDifferenceBusinessDays(ClipboardPage,String,int,int,int,int)
[candidate functions are]
@DateTime.TimeDifferenceBusinessDays("","20160607T134400.000GMT",5,0,0,0)
Invalid expression or reference: No suitable instance found
[seeking]
@(null:DateTime).TimeDifferenceBusinessDays(String,String,int,int,int,int)
[candidate functions are]
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Telstra
AU
Use @DateTime.TimeDifferenceBusinessDays(pxRequestor.pyCalender,"20160607T134400.000GMT",5,0,0,0)


Pegasystems
IN
I am trying to use this same function but unable to give the first arguement. Can anyone secify the format to enter the calendar name
Thanks Animesh


CA
In the activity, write a java step with below code and then use the local variable as desired.
java.util.Calendar cal=java.util.Calendar.getInstance();
Difference = com.pegarules.generated.pega_rules_datetime.TimeDifferenceBusinessDays(cal,"20160318T224645.845 GMT",5,0,0,0);
This should do.
Note : Difference is a Local variable.
Thanks


Tetco
SA
Hi Nikhil,
When i am using the Java code i am getting the difference as value as "Difference = Mon 2016/03/21 23:46:45 CEST"
I am expecting the difference but it's giving the date again as output.


Tetco
SA
Hi,
Did you anytime find any solution for the above query.


Pegasystems Inc.
US
I have been able to use the following to calculate the difference between business days.
Did you have a specific question or business use case related to this function?


Tetco
SA
It would be great help if you can give an example how you have used the function, so that i can try from my side also.


Pegasystems Inc.
US
Hello,
I put in an image in my original reply which apparently is not exhibited. Please see the following:


Pegasystems Inc.
US
Hi,
I am giving below in the Expression Builder.
TimeDifferenceBusinessDays(USDefault,CurrentDateTime(),1,0,0,0)
And getting the below error.
"Invalid expression or reference: No suitable instance found [seeking] @(null:null).TimeDifferenceBusinessDays(ClipboardPage,String,int,int,int,int)
It seems that it is not recognising the Calender variable.


Tetco
SA
I am also getting same error as mentioned in the last post, do anybody have any solution, please let us know, it would be helpful


Rabobank Netherlands
NL
Use BusinessCalendar.addTime method for example: @BusinessCalendar.addTime(@CurrentDateTime(), 5, 0, 0, 0, true, CalenderName) it will work.The 2nd last param indicates whether to use business calender or not.
-
Rupam Dalabar Meera Mohiddin Shaik Luqman Liang Hsien Masood