Displaying the last date in a series


https://www.nevron.com/Forum/Topic3481.aspx
Print Topic | Close Window

By Shawn Haggett - 14 Years Ago
Hi, we have a data set which consists of time data. We have two columns, the first is the date/time of the record (EventDate), the second is a cut down text field displaying the month and year of the record (Month). Using the Month column as a category, we produce a chart with data grouped into months on the X axis.

What we would like is to have a title to display something like "Displaying data as at: ", where is the largest date in our data set. This way, when new records are added, the graphs will update to inform the user of the date most recent record that was used to create the chart (as well as labelling charts if users take copies, to show how old the chart is).

I tried doing this with the expresion: ="As at: "&MAX(Fields!EventDate)
Where EventDate is the data/time record, however I get an invalid cast from DateTime to Double.

If this can't be done as an expresion, I imagine it is possible with code injection, however the SharePoint Vision documentation has very little to say about code injection or the available classes/methods/properties. I tried looking in the .NET Vision documentation, which contains documentation on available classes, however I can't find the NRSChartCodeContext class, or what's available in that class.

From looking at examples, I've determined that I can get access to the NSeries object for each series in the chart, but this contains the double value used by the chart to display its points/lines/bars/etc. What I think I need is the NDataSeries for the data/time column, so I can find the largest value in the series and display that, but I'm not sure if I can get to it within the code injection context.

Any help would be appreciated.
By Nevron Support - 14 Years Ago
Hi Shawn,

The automatic conversion from DateTime to Double is indeed not supported by the pivot, so that is why the natural expession based approach that you correctly chose first will not work.

For the next update of the chart (that will include a SharePoint 2010 installation) we will provide two additional functions that will allow you to get the min and max value from any variant array (MINVAR and MAXVAR. So achieving your request will be doable through the following expression:

=MAXVAR(Fields!EventDate)

For speed consideration the MIN and MAX functions will continue to work on numeric variants only. This is because performing a comparison on any type of data is much slower (altough you can compare DateTimes, Strings, Booleans etc. with the < and > operators), and the MIN and MAX function are mainly used for numeric statistics.

The code injection and the way in which you can consume values from the pivot are some other extensions that we are working on. However we want to keep it simple and backward compatible (and also compatible with our SSRS product line) and that is why we will be extending it very cautiously.

So we would suggest that you wait for the next update where this requirement will be implemented natively.