Skip to main content
omj2851
Known Participant
Aug 6, 2024 4:04 AM UTC
Question

Error while using subtractdays() function

I am facing the issue while trying to get the below mentioned logic through subtractdays() function.

logic: we need the value i.e. current date - 74 days

used expression:  subtractdays(today(), 74)

error found:

6 replies

karumurua531442
Participating Frequently
Aug 6, 2024 4:18 AM UTC

hi [mention:67d3e8c7ee954087ae38b3a86b2789c3:e9ed411860ed4f2ba0265705b8793d05]  what is the function you are using is that a plugin function?  may your complete requirements and expected output please, currently you can directly do todate(today()-74)  gives you 74 days back date. 

omj2851
omj2851Author
Known Participant
Aug 6, 2024 4:38 AM UTC

Hi [mention:3510a5189ce1477eaf2e09f5858c87e9:e9ed411860ed4f2ba0265705b8793d05] 

i have below mentioned code

if(
todate(fv!item.LastApproveDate) <= today() - (
cons!PPA_USER_APPROVAL_INTERVAL + cons!PPA_USER_APPROVAL_ESCALATION_INTERVAL
),
true(),
false()
)

Where i need to replace this part of logic

today() - (cons!PPA_USER_APPROVAL_INTERVAL + cons!PPA_USER_APPROVAL_ESCALATION_INTERVAL)

with

substractdays fucntion

Om Joshi
Inspiring
Aug 6, 2024 4:56 AM UTC

subtractdays() expects dateTime as its first input. But here, today() is of type date.

prasantap0900
Participating Frequently
Aug 6, 2024 5:31 AM UTC

The function "today()" returns only date not time. For the subtractDay() function, the first parameter you should pass date and time. I am attaching the snippet. Maybe it will be helpful.