Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Specialist
Specialist

if statement in Script

Hi experts

I have this statement in the loading script:

if(date(Timestamp, 'YYYY-MMM')= date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM'), [Event Reason]) as [Event Reason_new]

It is not working, although the date fields are correct in the app:

TomBond77_0-1708330800672.png

Any ideas?

 

1 Solution

Accepted Solutions
brunobertels
Master
Master

hi 

try 

if(date(floor(Timestamp), 'YYYY-MMM')= date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM'), [Event Reason]) as [Event Reason_new]

View solution in original post

3 Replies
brunobertels
Master
Master

hi 

try 

if(date(floor(Timestamp), 'YYYY-MMM')= date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM'), [Event Reason]) as [Event Reason_new]

theoat
Partner - Creator III
Partner - Creator III

Good morning,

This doesn't work because you're comparing a date and a timestamp. (The date function is a formatting function.
Try this :
if(date(dayname(Timestamp), 'YYYY-MMM')= date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM'), [Event Reason]) as [Event Reason_new]

Cordialement,
Théo ATRAGIE.

TomBond77
Specialist
Specialist
Author

solved it:

if(monthend(date(floor(Timestamp), 'YYYY-MMM'))= monthend(date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM')), [Event Reason]) as [Event Reason_new] ,