views:

48

answers:

2

I am trying to create a report that has some data values. Each data value can be of a 'good' or 'bad' quality. I would like to pass a value color through the dataset using a custom C# data provider object. Once in the report designer, I can use 'Fields!MyColumn.Value' and it works fine. There is also an option to type 'Fields!MyColumn.Color', but I don't know how to initialize it. Please help.

This is a code fragment I use to load some data to the report:

IDataReader dataReader = command.ExecuteReader();
  dataset.Tables["dtTable"].Load(dataReader);
  dataReader.Close();

  //provide local report information to viewer
  reportViewer.LocalReport.ReportEmbeddedResource =
       "Client.Reports.Reports.Sample.rdlc";

  //prepare report data sources
  ReportDataSource dsTable = new ReportDataSource();
  dsTable.Name = "dtTableData";
  dsTable.Value = dataset.Tables["dtTable"];
  reportViewer.LocalReport.DataSources.Add(dsTable);
A: 

This might help?

http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/3466efb4-7d23-4936-99ea-a061388a2bb0

nonnb
Thanks for the answer, but this is not exactly what I am after. Yes, I can use expressions to set the color based on the value, but in my case the color has no relation with the data. I want to initialize and use the dataset Fields!.?.Color parameter.It looks like this is somehow related to the MDX and there is some information here:http://msdn.microsoft.com/en-us/library/ms145573.aspxbut I am not sure how to apply this in my code in my custom Data Provider (DataReader and/or DataAdapter)
Vlad
A: 

I am not super familiar with the situation but it seems that if it takes a string you should be able to pass anything that the Color field in the report usually takes. Any string like "#ffffff" or "white" or an expression like '=IIF(Fields!MyColumn.Value = 1, "blue", "red")'. It if requires an integer, then you should set it according to http://msdn.microsoft.com/en-us/library/ms145991.aspx

Aaron D
I can pass color values, this is not a problem. Maybe the question title is not 100% accurate. I can create a new column in the dataset and set the value to "red" or "blue". This is the workaround I use right now. This way I have to type **Fields!MyColorColumn.Value** to get to my color. Instead, I want to have one multi-dimensional column and type **Fields!MyColumn.Value** for values and **Fields!MyColumn.Color** for colors. The color, like the value is required for each cell.
Vlad