IDimOrmCondition.Conditions

Syntax

Conditions: IOrmConditions;

Description

The Conditions property determines search conditions.

Example

In the example the form houses the following components: UiDimension, EditBox, DimensionCombo, Button. The OnClick event is described for the button, the OnShow event is described for the form.

Class UserForm: Form

EditBox1: EditBox;

uidimCountries: UiDimension;

dcCountries: DimensionCombo;

Label1: Label;

Button1: Button;

Mb: IMetabase;

Cat: IRubricator;

Inst: IRubricatorInstance;

pAttrs : IMetaAttributes;


Sub
UserFormOnShow(Sender: Object; Args: IEventArgs);

Begin

Mb := MetabaseClass.Active;

Cat := Mb.ItemById(EditBox1.Text).Bind As IRubricator; // EditBox1.Text contains identifier of time series database

Inst := (Cat As IMetabaseObject).Open(Null) As IRubricatorInstance;

pAttrs := Inst.Facts.Dictionary.Attributes;

uidimCountries.Object := pAttrs.FindById("COUNTRY").ValuesObject;

End Sub UserFormOnShow;


Sub
Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

DManager: IDimOrmManager;

DimModel: IDimensionModel;

DimInst : IDimInstance;

DClass : IDimOrmClass;

DCond : IDimOrmCondition;

Cond : IOrmCondition;

factory : IDimSelectionSetFactory;

selections : IDimSelectionSet;

selection : IDimSelection;

Element : IDimElement;

i: Integer;

Begin

DimModel := dcCountries.Dimension.Dimension;

DimInst := dcCountries.Dimension.DimInstance;

DManager := New DimOrmManager.Create;

DClass := DManager.CreateClass(DimModel);

DCond := DClass.CreateCondition;

Cond := DCond.Conditions.Add;

Cond.AttributeName := "Grouped";

Cond.Operator_ := OrmComparisonOperator.IsNotNull;

factory := New DimSelectionSetFactory.Create;

selections := factory.CreateDimSelectionSet;

selection := selections.Add(DimInst);

Element := DimInst.NewElement;

For i := 0 To DimInst.Elements.Count-1 Do

Element.Element := i;

If DCond.Evaluate(Element) Then

selection.SelectElement(Element.Element,False);

End If;

End For;

selection.CopyTo(dcCountries.Selection, True);

End Sub Button1OnClick;


End Class
UserForm;

Start the form, select elements in drop-down dimension menu, next click the button to change the selection: only the elements with non-empty value of the Grouped attribute are selected.

See also:

IDimOrmCondition