SqlText: String;
The SqlText property determines text of the MDX query, that was used to form the cube.
To define the physical name of the source cube in the server, use the IAdoMdCube.NativeName property.
The text of the specified MDX query has some restrictions:
The NON EMPTY keyword must not be used in the axis expression, use the NonEmpty function instead. The function is not available when working with a database based on SAP NetWeaver BW.
The HAVING condition must not be used in the axis expression, use the Filter function instead.
Calculated elements are prohibited by default in sampling subqueries. The restriction can be changed by setting the SubQueries parameter to 1 in the IAdoMdCatalog.ProviderString property.
Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier. An ADOMD cube with the CUBE identifier is created in the catalog. Add links to the AdoMd and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Cube: IAdoMdCube;
SQL: String;
Begin
MB := MetabaseClass.Active;
Cube := MB.ItemByIdNamespace("CUBE", MB.GetObjectKeyById("ADOMDTest")).Edit As IAdoMdCube;
//Get the MDX query based on which the cube is built
SQL := Cube.SqlText;
//Change the query
SQL := String.Replace(SQL, "Year", "Month");
//Refresh the cube
Cube.SqlText := SQL;
(Cube As IMetabaseObject).Save;
End Sub UserProc;
On executing the example ADOMD cube structure is refreshed by changing the MDX query, based on which the cube is built.
See also: