Aras Innovator Platform

Usage example

This section provides an example of using the public interface: There is a need to check if any valid combination will exist when certain variable options (values) are selected. Therefore, it needs to be checked if such selected variable options are valid in the Scope.

The corresponding server method code could be the following.

// Get IConfiguratorServices object.

Aras.Server.Core.Abstractions.IConfiguratorServices configuratorModule =

CCO.GetService<Aras.Server.Core.Abstractions.IConfiguratorServices>();

 

// Set targetScope.

Item targetScopeItem = this.newItem("Method", "scopeBuilderMethod");

string businessItemId = "6B9B49B827C44F38A97BBFB524CA5BD5";

targetScopeItem.setID(businessItemId);

 

// Get scope.

Aras.Server.Core.Configurator.ReadOnlyScope scope =

configuratorModule.GetScope(targetScopeItem);

 

// Create ScopeSolver.

Aras.Server.Core.Configurator.IScopeSolver scopeSolver =

configuratorModule.CreateSolver(scope);

 

string selectedVariable1Id = "62419B0CF8B1464CA73FF72B072924E5";

string selectedOption1Id = "3021A89854F24F38918BCF2CFC27CAD3";

string selectedVariable2Id = "0C6562E7925C4215ABE6E31EF0ED1BD2";

string selectedOption2Id = "B574E44C807545C2B74BA8A30CA8B319";

 

// Create selected variable options as a condition and set them to the solver.

scopeSolver.Condition = new Aras.Server.Core.Configurator.ExpressionLogical(

Aras.Server.Core.Configurator.ExpressionType.AND);

scopeSolver.Condition.InnerExpressions.AddRange(

new List<Aras.Server.Core.Configurator.ExpressionBase>

{

// SelectedVariableId is the Id of the selected variable.

// SelectedOptionId is the Id of corresponding option(value) of the selected variable.

new Aras.Server.Core.Configurator.ExpressionTerm(

Aras.Server.Core.Configurator.TermOperator.Equal,

new Aras.Server.Core.Configurator.TermOperandVariable(selectedVariable1Id),

new Aras.Server.Core.Configurator.TermOperandNamedConstant(selectedOption1Id)),

new Aras.Server.Core.Configurator.ExpressionTerm(

Aras.Server.Core.Configurator.TermOperator.Equal,

new Aras.Server.Core.Configurator.TermOperandVariable(selectedVariable2Id),

new Aras.Server.Core.Configurator.TermOperandNamedConstant(selectedOption2Id)),

});

 

// Null parameter for FindAllCombinations means that all scope variables will be used.

return scopeSolver.FindAllCombinations(null).Any();