Question

I have a Dataset with a Bunch of Columns used in a Report (DevExpress XtraReports) (DataSet being the DataSource). The Dataset has many columns, and i need to read a column (based on the row type), and decide which column value to read for the row, and apply formatting based on the row type.

Example:

DataSet

DataType    IntValue    RealValue   StringValue DateValue
Int32           123
DateTime                                        1/1/2011 1:23 AM
String                              XYZ
...

If the Datatype is DateTime, i need to read the DateValue column value, etc

I know we can use DataSet Expressions on computed columns, but cant find a way to apply the required Expression, and Format Data for the Report.

Is there a suggested way to handle this in the Report or at DataSet Level (excepting the formatting part)?

Was it helpful?

Solution

I'm not sure why you are taking this approach. This dataset is filled from a SQL datasource or some sort of backend? if that is the case, why don't you just get the computed column in the right format from the SQL directly? Wouldn't be a performance overhead to loop through all records to try and compute the "right" column?

Since it is a report, wouldn't displaying the data be enough? if you really need to use the type, you can bring that from sql as well, so you end up only with two columsn, type and data. If you can elaborate a little bit more on what you are trying to do, it will be helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top