Represents a query operation over specified IPivotData instance.
Inheritance Hierarchy
NReco.PivotDataSliceQuery
Namespace: NReco.PivotData
Assembly: NReco.PivotData (in NReco.PivotData.dll) Version: 1.4.1
Syntax
The SliceQuery type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SliceQuery |
Initializes new slicing query to specified PivotData instance.
|
Methods
Name | Description | |
---|---|---|
Dimension(String) |
Define dimension to select in result of this query.
| |
Dimension(String, FuncObject, Object) |
Define dimension constructed from keys of existing dimensions.
| |
Equals | (Inherited from Object.) | |
Execute |
Execute the query and return operation result as new PivotData instance.
| |
Execute(Boolean) |
Execute the query and return operation result as new PivotData instance.
| |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
Measure(Int32) |
Define measure aggregator at specified index to select in result of this query.
| |
Measure(IAggregatorFactory, FuncIAggregator, IAggregator) |
Define new measure aggregator calculated from existing cube measure(s).
| |
Measure(IAggregatorFactory, FuncKeyValuePairObject, IAggregator, IAggregator) |
Define new measure aggregator calculated from existing cube measure(s).
| |
Measure(String, FuncIAggregator, Object, Int32) |
Define formula measure.
| |
MemberwiseClone | (Inherited from Object.) | |
ToString | (Inherited from Object.) | |
Where(FuncKeyValuePairObject, IAggregator, Boolean) |
Filters data points based on a predicate.
| |
Where(String, FuncObject, Boolean) |
Filters dimension keys based on a predicate.
| |
Where(String, Object) |
Filters dimension keys by explicit list of values.
|
Remarks
Examples
var salesCube = new PivotData( new [] {"year","month","day","country","product"}, new CompositeAggregatorFactory( new CountAggregatorFactory(), new SumAggregatorFactory("amount") ), true );
var q = new SliceQuery(salesCube) .Dimension("year") .Dimension("country") .Dimension("product") .Where("country", new[]{"USA","Canada"}) .Measure(1); var salesAmountForUsaAndCanada = q.Execute(true);
Examples
var q = new SliceQuery(salesCube) .Dimension("year") .Dimension("quarter", (dimKeys) => { var month = Convert.ToInt32( dimKeys[1] ); // "month" dimension index return (int)Math.Ceiling((float)(month)/3); }).Where( (dataPoint) => { var compositeAggr = dataPoint.Value.AsComposite(); // CompositeAggregator is used if cube has >1 measure var countOrders = Convert.ToInt32( compositeAggr.Aggregators[0].Value ); return countOrders>=10; // include data point by custom condition }); var bigSalesByYearAndQuarter = q.Execute(true);
See Also