Accessing Dataset from embedded code.


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

By James - 10 Years Ago
Hi,

Currently I'm trying to get some labels on the chart using Nevron Vision for SSRS 2014.1 for SSRS 2008 / SSRS 2008R2 (build version: 14.5.23.12). But because some of the labels can be very long (e.g. "This is a long annotation for this data point 20th June 2013"), so we have a shortened version (e.g. *01 ) to be placed as the data point labels, and the longer version of the text be be displayed in a custom drawn NRoundedRectangularCallout which will be inserted on the chart itself.

So, I would like to check if currently there's any way to get the chart's dataset from the embedded code. At the moment, I can only access the series's point label via the following code, but I'm not sure how to get the data from another column which is queried in the dataset.

public static void RSMain(NRSChartCodeContext context) {

Nevron.Chart.NChart chart = context.document.Charts[0];
NLineSeries ls = chart.Series[0] as NLineSeries;
NDataSeriesString dss = ls.Labels;
}

By Nevron Support - 10 Years Ago
In general by the time the custom code is executed, the data is already fed to the chart. There is no way to access the initial data source from your code, since SSRS does not provide custom report items with an access to it. The report item simply receives a hierarchical structure to display. So if you want to make some post processing you need to concatenate all the data you need into the data point label, and then analyze that data from your code. For example use this as expression for your label:
=Fields!SomeField1 + ";" + Fields!SomeField2
Now your data label values will have information for both columns - you need to split the data label by the ; char and analyze the values.