Jeebwise
Jeebwise

Reputation: 177

SSRS-Reports formatting

I am having a few issues using SSRS-Reports 2005.

The first one is I am trying to use the datediff function to change the background color of a cell based on the two dates being within 30 days of each other.

=iif(
DateDiff("d",DateString,Fields!Insurance_Certificate.Value)<= 30, "Tan", "White"
)

I have my fields formatted through the initial query so they look like mm/dd/yyyy. I guess my first question is how do I see what value is being evaluated because whatever this is returning can't be right.

Upvotes: 0

Views: 185

Answers (2)

Jeroen
Jeroen

Reputation: 63699

my [...] question is how do I see what value is being evaluated

There is no real "debugger" available like you would have in -say- a WinForms C# app. Instead, you have several "raw" "debugging" options:

  • Render Fields!Insureance_Certificate.Value in a seperate cell, as text
  • Render DateDiff("d",DateString,Fields!Insurance_Certificate.Value) in a seperate cell, as text
  • Right-click your dataset, select "Query...", and execute the query manually. Inspect the values for your field. Make sure they're what you'd expect.
  • Render your DateString in a seperate cell, with and without a cast to a date.

Other than that @MarkBannister has a great suggestion, using actual Dates as opposed to strings for your fields and variables. One additional thing to note about this, is that date parsing may be culture-specific. Be sure you understand and know in what culture your DateString is being parsed. The above "debugging" options may help you find out.

Upvotes: 1

user359040
user359040

Reputation:

I suggest querying your date fields as dates (instead of as strings), comparing them using the DateDiff function as in the question and formatting the date output using the Format property of the appropriate textboxes in SSRS.

Upvotes: 0

Related Questions