There's no reason to cast your string as a date if you're entering the above range into find mode.
"4/1/" & Year ( PaymentInvoiceRecord::DatePaid ) & "...3/31/" & Year ( PaymentInvoiceRecord::DatePaid )+1
should do it. The only exception would be if the DatePaid field was invalid and the Year function was not working. Try running: Year ( PaymentInvoiceRecord::DatePaid ) through your data viewer to make sure it's returning something.
Also, make sure your system time preference is set correctly. If you try to enter 3/31/2015 into a country code that only accepts 31/3/2015, you can also run into issues.
The expression is valid. The only problem seems to be the referenced field. Maybe you are not in the right context (while script step executes) for the expression to be successfully evaluated.
The field PaymentInvoiceRecord::DatePaid is probably just a regular field (not global storage) and has no value in Find mode.
Try setting a $variable with the value of the field before you enter Find mode, and use the variable in your query.
Set variable ( $year ; Year (PaymentInvoiceRecord::DatePaid ) )
Set field ( PaymentInvoiceRecord::DatePaid ; Date ( 4 ; 1 ; $year )&"..."&Date ( 3 ; 31 ; $year+1 ) )
Hi Mike !
I checked using Dataviewer Year ( PaymentInvoiceRecord::DatePaid) is returning correct value and so is the Month (Year ( PaymentInvoiceRecord::DatePaid )
But when I run the same functions wihthin a script from the same layout : PaymentInvoiceRecord ,
I get no return values ...
What is your context when you run the script? Perhaps you go to another layout where you do not have access to the current value of that field?