What is wrong with this syntax...(I'm new)
I am working in a Perspective Report trying to di a date difference as a parameter. It would be calculated based on the StartDate/EndDate inputs that i have above.
If this is not proper then what do i need to do in the script below to reference the StartDate/EndDate parameters to give me the difference between them in hours.

I get this error and it doesn't make sense.

What's the default value you've entered for StartDate
?
Tip: your report (and hence your question) have nothing to do with Perspective. The reporting module is separate from both Vision and Perspective. I'll fix the tags for you.
Regarding the error it's telling you that the first argument, {StartDate}, is null so you need to figure out why.
You've provided expressions for StartDate and EndDate that produces strings. The parameters are set to the Date datatype. Fix this first. (Don't use strings for dates.)
A couple of problems:
You have set the Parameter Type to Date but the calculated value is a string. That won't work. Remove the dateFormat function.
Same with EndDate.
The Expression Language dateDiff function is expecting dates, not strings.
1 Like
I am unable to remove the string format as it is used in a previously made SQL stored procedure that I cannot change. There is a way around it with the date parcing thing I have looked up but it is messy. I think I have a work around for now. It too is messy but simpler I think. Thanks
- Pass the dates into the report as Date data types. Then you can calculate the dateDiff.
- Format the dates when you pass them to the stored procedure if it requires the date in string format.
Note and learn well: dates should be saved as date datatype in the database. Whoever set it up shouldn't have done that. Work with the date datatype and only format dates at the last moment to display for human consumption.
2 Likes