IsAttributeActive(Attribute: Variant): Boolean;
IsAttributeActive(Attribute: object): boolean;
Attribute. Attribute.
The IsAttributeActive method returns whether a specified group attribute is available for the factor.
If IsAttributeActive returns True, a group attribute is available for the factor.
The following items can be passed as a value of the Attribute parameter:
Attribute implemented by the IMetaAttribute interface.
Attribute identifier as a string.
Attribute key as an integer number.
The IMetaDictionaryDataInfo method returns whether the time series is included in the specified group.
Executing the example requires a time series database with the FC_GROUPS identifier that contains a group attribute with the ATTR_GROUP identifier. Add links to the Metabase, Rds, Cubes system assemblies.
Sub UserProc;
Var
mb: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
Rub: IRubricator;
RubrIn: IRubricatorInstance;
Dic: IMetaDictionary;
i: Integer;
key: Array Of Integer;
FactsLookup: IRubricatorFactsLookup;
FactData: IRubricatorFactData;
FactInfo: IMetaDictionaryDataInfo;
Attr: IMetaAttribute;
Memb: IMetaDataMember;
MembGroup: IMetaDataMemberGroup;
GroupRecord: IMetaDataMemberRecord;
Begin
mb := MetabaseClass.Active;
RubDesc := mb.ItemById("FC_GROUPS");
Rub := RubDesc.Bind As IRubricator;
// Receive database time series dictionary
Dic := (Rub.Facts As IMetabaseObject).Edit As IMetaDictionary;
// Receive group attribute of time series
Attr := Dic.Attributes.FindById("ATTR_GROUP");
// Receive array of time series keys
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
FactsLookup := RubrIn.CreateFactsLookup;
i := FactsLookup.LookupFactors.Length;
key := New Integer[i];
key := FactsLookup.LookupFactors;
For Each i In key Do
FactData := RubrIn.GetFactData(i);
FactInfo := FactData As IMetaDictionaryDataInfo;
If FactInfo.IsAttributeActive(Attr) Then
Debug.WriteLine(Time series: + FactData.Mnemo);
Memb := FactData.Record.Members.FindById(Attr.Id);
MembGroup := Memb As IMetaDataMemberGroup;
Debug.WriteLine( group attribute value: + MembGroup.SelfValue);
GroupRecord := MembGroup.GroupRecord;
Debug.WriteLine( availability for editing: + GroupRecord.IsEdited.ToString);
End If;
End For;
End Sub UserProc;
After executing the example value and availability for editing a group attribute for all time series included in the group are displayed in the console window.
Executing the example requires a time series database with the FC_GROUPS identifier that contains a group attribute with the ATTR_GROUP identifier.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
Rub: IRubricator;
RubrIn: IRubricatorInstance;
Dic: IMetaDictionary;
i: integer;
key: System.Array;
FactsLookup: IRubricatorFactsLookup;
FactData: IRubricatorFactData;
FactInfo: IMetaDictionaryDataInfo;
Attr: IMetaAttribute;
Memb: IMetaDataMember;
MembGroup: IMetaDataMemberGroup;
GroupRecord: IMetaDataMemberRecord;
Begin
mb := Params.Metabase;
RubDesc := mb.ItemById["FC_GROUPS"];
Rub := RubDesc.Bind() As IRubricator;
// Receive database time series dictionary
Dic := (Rub.Facts As IMetabaseObject).Edit() As IMetaDictionary;
// Receive group attribute of time series
Attr := Dic.Attributes.FindById("ATTR_GROUP");
// Receive array of time series keys
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
FactsLookup := RubrIn.CreateFactsLookup();
i := FactsLookup.LookupFactors().Length;
key := New Integer[i];
key := FactsLookup.LookupFactors();
For Each i In key Do
FactData := RubrIn.GetFactData(i As uinteger, DictionaryGetDataOptions.dgdoNone);
FactInfo := FactData As IMetaDictionaryDataInfo;
If FactInfo.IsAttributeActive(Attr) Then
System.Diagnostics.Debug.WriteLine(Time series: + FactData.Mnemo);
Memb := FactData.Record.Members.FindById(Attr.Id);
MembGroup := Memb As IMetaDataMemberGroup;
System.Diagnostics.Debug.WriteLine( group attribute value: + MembGroup.SelfValue);
GroupRecord := MembGroup.GroupRecord;
System.Diagnostics.Debug.WriteLine( availability for editing: + GroupRecord.IsEdited.ToString());
End If;
End For;
End Sub;
After executing the example, value and availability for editing a group attribute for all time series included in the group are displayed in the console window.
See also: