DateAdd() returns faulty Date in SQL Server Reporting Services - ssrs-2008

I have a report that takes a date as a parameter.
If I use =Parameters!Date.Value, the report runs fine.
However, if I use =DateAdd("d", 1, Parameters!Date.Value), the report is left blank, even though the formats are exactly the same:. (Note: it simply cannot run. It's not that there are no values to return as the field names don't return either.)
I have also tried =DateAdd(DateInterval.Date, 1, Parameters!Date.Value)
=DateAdd("d", 1, Parameters!Date.Value)
=DateValue(FormatDateTime(DateAdd("d", 1, Parameters!Date.Value), DateFormat.ShortDate )) and many variations thereof but I can't seem to crack it!
Update
If I use DateInterval.Month instead of DateInterval.Day then the date is still incremented as desired (12/22/2010) but the table shows up! Interesting how my local settings are dd-mm-yyyy and these dates are mm-dd-yyyy.

Try changing the locale of the report to EN-GB (I'm assuming you're in the UK), as the report might be getting confused between different date formats.

Related

TadvGridFilterPanel on TadvStringGrid filters dates wrong

I've got a TAdvStringGrid connected to a TAdvGridFilterPanel. The grid contains several columns of which 4 are dates. The locale of my PC is 'nl-NL' (Dutch). Date format in The Netherlands is 'dd-mm-yyyy'. When I filter dates it doesn't filter correctly. Things I tried that did not help:
In the OnGetFormat returned the ssDate for date columns
Fiddled arround with FormatSettings (local and global) with DateFormat and DateSeparator. This did solve some of the display problems. Date were display as '31/12/2000'. After changing the FormatSettings this changed to '31-12-2000'. But it's not nice to use the global FormatSetting so discarded that solution.
Tried to find an event that fires on compare. If it exists, I didn't find it.
In other words. Or I'm doing something wrong or there's a bug in the TMS code. Any idea's?

The difference in strings in Tableau

I am using Tableau Server version 10.4.3
I have a dimension rTime which has string value. the entries in rTime is of like this
May 10, 2019 8:59:56.303 PM UTC
I want to check whether the rTime is today or not. I cannot use DateParse since my server doesn't have this functionality.
I created a calculated field CheckrTime with below content :
STR(LEFT(SPLIT([rTime],':',1),LEN(SPLIT([rTime],':',1))-2))
When I am dragging CheckrTime into workspace area, the output is coming in below format which is what I wanted :
May 10, 2019
When I am checking ISDATE("May 10, 2019") (a normal string), it is outputting TRUE as expected but when I am checking ISDATE(CheckrTime) it is outputting FALSE . Why?
The reason I am checking above thing is I am looking to use DATEDIFF function of tableau in this way:
DATEDIFF('day', DATE(CheckrTime), TODAY()) == 0
NOTE
If someone is wondering ,I have taken care of the level of granularity.
If you have a better solution then the one I am following, please do tell me.
This is working for me. I would expect May 10 <> May 16 (today) and therefore return false. However, when I change your example to today's date it does in fact come back as true.
You could also try this formula for the date LEFT([rTime],FINDNTH([rTime],' ',3)). It is slightly less complicated but will give you the same answer.
Calculated field (date type) depends the locale used which defines date format. Are you able to use Date function?
In Tableau website there is a example using english locale
For string 06May2017
DATE (LEFT([Original Date], 2) + "/" + MID([Original Date],3,3) + "/" + RIGHT([Original Date],4))
Above mentioned highligts / character between digits which is depending on locale

JasperReports fails to render a Time Series Chart with error "null 'period' argument"

I have a relatively simple query that returns 3 fields of data per row, with a date. Something like this:
SELECT DATE(date) AS date, val1, val2
FROM tables
WHERE ...
From the report itself (detail band), I can confirm that all the "date" fields are non-NULL. The settings for my Time Series Chart are as follows:
TimePeriod: Day
Time Period Expression: $F{date}
(Series) Value $F{val2} - $F{val2}
The error I get is:
java.lang.IllegalArgumentException: Null 'period' argument.
at org.jfree.chart.util.ParamChecks.nullNotPermitted(ParamChecks.java:65)
at org.jfree.data.time.TimeSeriesDataItem.<init>(TimeSeriesDataItem.java:99)
at org.jfree.data.time.TimeSeries.addOrUpdate(TimeSeries.java:887)
...
I've even tried setting the "Time Period Expression" to the expression (null == $F{date} ? "foo" : $F{date}) just to see if I can get it to fail in a different say (like ClassCastException), but it still fails with the same message.
The data type for $F{date} is java.sql.Date, and the data type for the other two fields is java.lang.Long for both.
I'm using Jasper Studio 6.4.0 if that makes any difference.
I may have found an answer, and it looks like it might be a bug in JasperReports.
I searched the web for answers for this question before posting, and most questions went unanswered or responses were along the lines of "happening to me, too" or "works for me" without any real answer.
After making arrangements for every single possible null value to be handled, it still didn't work. So I tried changing the "TimePeriod" setting to "" just to see what would happen. No change, but going back to edit the chart, I noticed that "Day" was still the setting for the "TimePeriod" parameter. Weird.
I really want day-level reports, but I was grasping at straws, so I changed the TimePeriod to "Week", and the report ran successfully.
Then, I changed the "TimePeriod" from "Week" back to "Day" and it's running without error. So perhaps the default "TimePeriod" setting is in fact <NULL> but Jasper Studio shows that as "Day" when it's really not? I dunno. But try changing the TimePeriod to something else, then to what you really want.

Changing the default date format in classic asp when using the "date" function

I'm migrating a whole bunch of web pages that were written in classic asp over to a new server, and have discovered many references to the simple date() function, like:
if cint(left(date,instr(date,"/")-1)) < 9 then blah blah
I'm getting errors because the new server's default date format is returning yyyy-mm-dd, and the code above is expecting it to be in dd/mm/yyyy format.
Rather than manually fixing every occurrence, of which there could be hundreds, I'm looking to see if I can change the default date format for asp so that date() returns dd/mm/yyyy. I thought by simply changing the system's short date format would do the trick, but even after restarting the server it's still showing yyyy-mm-dd.
Is there a setting somewhere where you can specify the default date format when using the date() function?
This worked for me:
change global.asa, in the Sub Session_OnStart, add a line
Session.LCID=1033

Sending parameters to report from Java code

I need to send a timestamp value as parameter from java to JR report. I tried the following code but I'm getting a blank report.
My JRXML File:
`
`
The report works fine with normal date parameter but fails to display with Time-stamp value.
My Java code :
`
I tried various values of timestamp Ex: (new java.sql.Timestamp(2013-02-27) but it is not working.
Use:
new SimpleDateFormat("yyyy-MM-dd").parse("2012-01-01");
Simply putting:
new Date(2012-01-01);
would give definitely wrong date, probably EPOCH start date.
Ensure it's MM not mm when parsing your date for month. See SimpleDateFormat javadoc
EDIT
See the image. The date your default values will generate is around 1970.
Hence your Between Condition will get all the values between 1970 to Today.
EDIT : 2
In my opinion You are setting wrong parameter in Table's datasource.
Instead of setting From_Date & To_Date from Fields set them as parameter from the main report itself.
Refer Image.