Hello,
how create a slice to copy data inside the cube from the X element of the dimension (version) to the Y element of the dimension (version)?
The process would use a dynamic slice, that will be dependent on version, period (!!!! months)
and will suppress zero values. Version and period (!!! year) are defined in the listviews (global variables).
So, in the listview is defined the year, but the process would use only the base elements of the year (months).
There are 7 dimensions in the cube.
Our current script is attached below.
#define EngineVersion 5.0
#define RuntimeVersion 5.0
void TESTB_PulePelne()
@Description: "Kopiowanie danych wg. wersji w kostce B_Pule";
@Category: "Test";
@Returns: "No value returned";
{
string cube = "TEST";
string sourceWersja="FCT01_2022";
string targetWersja="FCT01_2023";
// 1. Create a connection to the OLAP server.
OLAPConnection olapconnection = OLAPCreateNamedConnection("");
// 2. Create string list for target data area
StringListList targetElements = CreateStringListList();
StringList kategoria = ConvertToStringList(OlapDataAreaBCells);
StringList jednostka = ConvertToStringList(OlapDataAreaBCells);
StringList konto = ConvertToStringList(OlapDataAreaBCells);
StringList lp = ConvertToStringList(OlapDataAreaBCells);
StringList czas = ConvertToStringList(OlapDataAreaBCells);
StringList wersja = ConvertToStringList(targetWersja);
StringList miara = ConvertToStringList(OlapDataAreaBCells);
Append(targetElements, kategoria);
Append(targetElements, jednostka);
Append(targetElements, konto);
Append(targetElements, lp);
Append(targetElements, czas);
Append(targetElements, wersja);
Append(targetElements, miara);
// 3. Create string list for source data area
StringListList sourceElements = CreateStringListList();
StringList src_wersja = ConvertToStringList(sourceWersja);
//StringList src_miara = ConvertToStringList(sourceMiara);
//StringList src_slFirma = ConvertToStringList(sourceFirma);
Append(sourceElements, kategoria);
Append(sourceElements, jednostka);
Append(sourceElements, konto);
Append(sourceElements, lp);
Append(sourceElements, czas);
Append(sourceElements, src_wersja);
Append(sourceElements, miara);
// 4. Delete all existing values in the target area.
// Filter data area to values that are not null (suppress null values). Use base elements only
OLAPDataArea deleteValues = OLAPCreateDataArea(olapconnection, cube,
OlapDataAreaIncludeB | OlapDataAreaSuppressNull, OlapDataAreaOperatorNone,
0.0, OlapDataAreaOperatorNone, 0, targetElements);
OLAPDeleteDataArea(deleteValues);
// 5. Filter data area to values that are not null (suppress null values). Use the base elements only
OLAPDataArea localValues = OLAPCreateDataArea(olapconnection, cube,
OlapDataAreaIncludeB | OlapDataAreaSuppressNull, OlapDataAreaOperatorNone,
0.0, OlapDataAreaOperatorNone, 0, sourceElements);
// 6. Copy Data area
OLAPCopyDataArea(localValues, cube, "Relative", 1.0, targetElements, sourceElements, false, false);
// 7. Close OLAP connection
OLAPDisconnect(olapconnection);
}