Hierarchy support for batch functions OLAPCreateDimensionBegin and OLAPCreateEditDimensionRequest
OLAPCreateDimensionBegin
and
OLAPCreateEditDimensionRequest
to add elements to hierarchies in a
batch.This is the declaration of the OLAPCreateDimensionBegin
function:
void OLAPCreateDimensionBegin (OlapConnection connection, string dimensionName, string dimensionDescription, string hierarchy)
These are the parameters of the OLAPCreateDimensionBegin
function:
Parameters | Description |
---|---|
connection |
The connection to OLAP to be used |
dimensionName |
Name of the dimension to be created |
dimensionDescription |
Description of the new dimension |
hierarchy |
Name of the hierarchy |
The OLAPCreateDimensionBegin
function does
not return a value.
The OLAPCreateDimensionBegin
function throws
an exception, if the dimension cannot be created.
The dimension is overwritten, if it already exists.
After the creation of all elements, you must also call the function OLAPCreateDimensionEnd
.
This is the declaration of the OLAPCreateEditDimensionRequest
function:
OLAPEditDimensionRequest OLAPCreateEditDimensionRequest (string dimensionName, string hierarchy)
These are the parameters of the OLAPCreateEditDimensionRequest
function:
Parameters | Description |
---|---|
dimensionName |
Name of the dimension to be edited |
hierarchy |
Name of the hierarchy to be edited |
The OLAPEditDimensionRequest
function
returns a new OLAPEditDimensionRequest
instance.
The OLAPEditDimensionRequest
function throws
an exception, if the dimension cannot be created.
To commit the requested changes, you must call the function OLAPSendRequest
.
The subsequent code example demonstrates how to create a new dimension with a named hierarchy:
#define EngineVersion 5.0
#define RuntimeVersion 5.0
void MyOLAPCreateDimension()
@Description: "Demonstrates how to create a new dimension with a named hierarchy";
@Category: "Demo";
{
string dimension = "MyRegions";
string dimensionDescription = "Created with AppEngine";
string hierarchy = "MyRegionsHierarchy";
// 1. Create a connection to the OLAP server
OLAPConnection olapconnection=OLAPCreateNamedConnection("Training");
// 2. Create dimension and hierarchy
OLAPCreateDimensionBegin(olapconnection, dimension, dimensionDescription, hierarchy);
// 3. Add elements that need to be added
OLAPAddNumericalElement(olapconnection,"All");
// 4. Commit changes with OLAPCreateDimensionEnd
OLAPCreateDimensionEnd(olapconnection);
// 5. Close OLAP connection
OLAPDisconnect(olapconnection);
}
The subsequent code example demonstrates how to edit an existing hierarchy of a dimension:
#define EngineVersion 5.0
#define RuntimeVersion 5.0
void MyOLAPCreateEditDimensionRequest()
@Description: "Demonstrates how to edit an existing hierarchy of a dimension";
@Category: "Demo";
{
string dimension = "MyRegions";
string dimensionDescription = "Created with AppEngine";
string hierarchy = "MyRegionsHierarchy";
// 1. Create a connection to the OLAP server.
OLAPConnection olapconnection=OLAPCreateNamedConnection("Training");
// 2. Create an OLAPEditDimensionRequest instance.
OLAPEditDimensionRequest rRegion = OLAPCreateEditDimensionRequest(dimension,hierarchy);
// 3. Add elements that should be added within the request
OLAPAddNumericalElement(rRegion,"US","All",1.0);
OLAPAddNumericalElement(rRegion,"Europe","All",1.0);
OLAPAddNumericalElement(rRegion,"Australia","All",1.0);
// 4. Commit changes with executing the request
OLAPSendRequest(olapconnection,rRegion,true);
// 5. Close OLAP connection
OLAPDisconnect(olapconnection);
}