SetCustomValue(Value: Variant);
Value. Custom label that should be set.
The SetCustomValue method sets a custom label for the current cache instance.
Executing the example requires a standard cube with the STD_CUBE identifier. A data set is cache for the cube.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MDesc, CacheDesc: IMetabaseObjectDescriptor;
CacheSaver: ICubeCacheSaver;
Items: ICubeCacheItems;
Item: ICubeCacheItem;
Begin
MB := MetabaseClass.Active;
MDesc := MB.ItemById("STD_CUBE");
// Get cache storage
CacheDesc := GetCache(MDesc);
If CacheDesc <> Null Then
CacheSaver := CacheDesc.Bind As ICubeCacheSaver;
// Cache instances from DBMS
Items := CacheSaver.GetItemsFromDatabase;
If Items.Count > 0 Then
Item := Items.Item(0);
Debug.WriteLine(Item.CustomValue);
// Change label for cache instance
Item.SetCustomValue("Change date: " + DateTime.Today.ToString);
End If;
End If;
End Sub UserProc;
Function GetCache(MObj: IMetabaseObjectDescriptor): IMetabaseObjectDescriptor;
Var
Desc: IMetabaseObjectDescriptor;
Begin
For Each Desc In MObj.Children Do
If Desc.ClassId = MetabaseObjectClass.KE_CLASS_CUBE_CACHE_SAVER Then
Return Desc;
End If;
End For;
Return Null;
End Function GetCache;
After executing the example, cache instance will be obtained for the specified cube. Custom label value for the first instance will be displayed in the development environment console. After this the custom label will be changed.
See also: