Question
Atos
IN
Last activity: 28 Aug 2024 4:48 EDT
Declare expression is not giving result as expected.
Hi,
I have written a declare expression to calculate age based on customer's Date Of Birth. But I am getting some default value even without entering some DOB value. After entering the some value in DOB field then it returns correct value as expected. Kindly help me out.
My declare expression is @DateTime.DateTimeDifference(.DateOfBirth+"T000000.000 GMT",@(Pega-RULES:DateTime).CurrentDateTime(),"Y")
and default value it's showing is -2.147483648E9.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 28 Aug 2024 4:48 EDT
JPMC
IN
@DeepakM60 Have you tried with an IF ? Can you rewrite your declare expression to calculate the value only if DateOfBirth has value?
Something similar
Atos
IN
@BhanuPrakash_G I haven't tried with IF. I will try and see
Thanks for your reply!
Atos
IN
@BhanuPrakash_G Hi,
I tried it with "If and Otherwise" condition and It worked. At run time, when I change DOB value age value is not changing still it shows "zero" because I gave age value equals to "zero" in otherwise condition.
While storing into data base, value is getting stored as expected.
Kindly provide me the solution.
Regards,
M.Deepak
Pegasystems Inc.
IN
@DeepakM60 Hi Deepak Can you please try using post value on change of date in your Section that would solve your issue
Atos
IN
@SrinidhiM I tried but it is not working and age field value is not updating in view at run time. Please look into below picture and let me know if there is any mistake.
Pegasystems Inc.
IN
@DeepakM60 Hi, Can you try refresh section instead of post value and see if you are seeing the values
-
Deepak Mallireddy
Atos
IN
@SrinidhiM Hi mam,
It's worked. Thank you so much for your valuable suggestions. Could you please explain what display:refresh does?
Pegasystems Inc.
IN
@DeepakM60 Hi Deepak,
The refresh section is similar to reload, it just refreshes the current state of the section which would help in displaying the latest data from clipboard.
Atos
IN
@SrinidhiM Thank you so much!
Eclatprime Digital Private Limited
IN
Please use this expression @whatComesBeforeFirst((.CurrentDate-.DOB)/365,'.')
For your reference, please find attached document.
Thanks
Atos
IN
@Sai Guggilla Hi,
I will try this way and check if it is worked or not. Anyway thanks for your suggestion.
Regards,
M.Deepak
Updated: 4 Nov 2022 4:02 EDT
EY
IN
Hello @DeepakM60
Try enabling the Legacy from actions and after changing it to legacy expression change the Calculate Value to whenever Input Changes Or whenEver used from Change tracking Tab .Hope this may help
-
KrishnaMohan Kadapa Harika Uppalapati Thomas Bollen