Is it possible to add a measure dynamically bypassing th data source altogether.
For example, If an Excel file is loaded in the cube and displayed in the grid. Is it possilble to have the user create a new measure and added into the collection of measure. This measure will be essentialy a sum and a product of two other measure. Also, we want to display it right next to other measure in the grid.
Thanks.
Hi Alex,
Have a look at the attached sample. It covers different cases so refer to the comments in code. If you have any questions let me know.
Plamen.
Sorry - forgot to add it in the first place. As far as I understand - using measures is possible for numeric properties only . Am I right ?
Thanks,
Alex
Thanks a lot Plamen for a quick answer.
Here are the details on what I need to achieve :
I need to create functionality that allows users add at run time new "derived" column to the grid and data selector . For example data source type has a string property Rating . I need to add new custom column with , say, name "MyRating" and the value of this column should set like :
If Rating LIKE ‘%AAA%’ -> CustomRating = AAA
ELSE -> CustomRating = Non-AAA
I was hoping to avoid "re-building" the data source itself and adding new property to it at the run time.
Can I use DimensionMetadata class to achieve it ?
Say I will create new DimensionMetadata instance with SourcePropertyName = "Rating" and use CustomAggregator to return "AAA" or "Non-AAA" values based on some logic?
Or , I ultimately need to have a property named "CustomRating " in my data source type for it ?
Thanks gain,
Hello Alex,
Dimension metadata is used to put some details about the dimension before it is created. Adding new metadata instances once data source is initialized has no sense.
Could you give us more details about your scenario? Is it about to create a dimension or it is more like a measure?
Hi,
I have a question that I think is related to the discussed topic here.
In fact I need to create kind of derived column.
For that I am creating new DimensionMetadata and adding it dynamically dimensions to my cube settings. I need to start with the dimensions that would use source property of String type.
I have defined custom aggregator
public class CustomStringDimensionAggregator : Aggregator<String>
and overriden its two Evaluate methods to return dummy string value. The thing is they are never being called at the run time. I have tried specify Aggregator Type as Unknown or None - same result.
My question - is it possible to create dynamically dimensions at the run time and difine their values ? Should I use Custom or Predefined Aggregators for this ?
Thanks a lot,