Discussion
Areteans
GB
Last activity: 4 Oct 2018 11:08 EDT
how to compare date using expression builder
I want to compare a date (if it is in the past )in when condition of an activity
the input date was given in yyyymmdd format and the when condition given was @(Pega-RULES:DateTime).isDateInThePast(.pyLabel) using expression builder
But this is not working,the condition is false always no matter what date I give
Can anyone suggest a solution?
**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!
Ai4Process
GB
Hi,
The function works fine. Now, because you are using .pyLabel (String/text) you need to convert this first using a temp property and use something like:
- Property-Set in a step 1
- .MyTempDate = @(Pega-RULES:String).toDate(.StringMMMYYDD)
- WHEN in a step 2
- @(Pega-RULES:DateTime).isDateInThePast(.MyTempDate)
Or use another function such as: @(Pega-RULES:DateTime).pxDateTimeisPastOrFuture(@(Pega-RULES:String).toDate(.StringMMMYYDD), true)
Pega Academy Support Team
-
Suru Kaushal
Areteans
GB
Thanks alot...it worked
FDIC
US
My requirement is similar but I am getting syntax errors while evaluating. I have to compare
1. If a (ClipBoardProperty) Date falls between two particular dates
2. In a expression evaluation in a Decision Tree
(For example :- if ClipBoard Property RandomDte = 20120925T040000.000 GMT, I need to find out if this ClipBoard Property RandomDte falls between Sep 1 of 2012 and Dec 1 of 2012 dynamically)
How can I create two NEW dates -
a.) Say Sept 1 of the ClipBoard Property DateTime Object's YEAR Field and Dec 1 of the SAME Year - on the fly - in a Decision Tree using @(Pega-RULES:DateTime) and then
b.) Evaluate if my property falls between the above two generated dates.
Any pointers with syntax would be appreciated.
Tata Consultancy Services
IN
hi you can use @(Pega-RULES:ExpressionEvaluators).DateIsInRange function and build your expression ,which returns boolean value.
hope this would help you.
Ai4Process
GB
Health First
US
Hi-
I have a requirement where there is a page list with 'Date' field on each page and I wanted to find out the index of the page which has the latest date. Is there a function that is available to use?
I wanted to do this in Data transform, so don't want to use obj-sort in an activity.
Appreciate your response in advance.
Ai4Process
GB
Hi,
An easy way to deal with that in a Data Transform would be to use the Sort function.
Have just one line in your DT
Sort: .MyPageList then click on the "key" icon and type: .MyDateProperty / Ascending
After executing your DT then the index 1 contains your earliest date
Note you are modifying the order of your list in memory.
Damien
Tech Mahindra pvt ltd
CA
Hi Damien,
i have a requirement like compare the date time and if the result is <1 day to current date i need to run some other activities..how to achieve this.
ex: Cut off Date time="20170423T001100.000 GMT"
Current Date time="20170423T001100.000 GMT"
if it less then 1 day then only i have to go ahead.
Appreciate your help.
Thanks,
Raj