GetTreeElementsResult SetExp(
ExpressionId tExpressionId,
TermProviderId tTermProviderId,
ExpOperations tOperations,
ExpressionArgs tExpressionAgrs)
tExpressionId. Moniker of the expression, for which operation is executed.
tTermProviderId. Moniker of the provider, which will process terms.
tOperations. Operation execution parameters.
tExpressionAgrs. Terms and term parameters used on executing the operation.
The SetExp operation is used to form terms by the sent information.
This operation enables the user to get terms that are used to form end expressions by the sent information about dimension elements, functions (mathematical, statistical, and so on), operations (arithmetic, logical, and so on). The obtained expressions are used by Foresight Analytics Platform kernel to calculate values.
To execute the operation, specify monikers of the expression, for which terms are formed, in tExpressionId and tTermProviderId, and the provider that processes terms and creates their formulas. Monikers are created depending on the object, which expression editor was worked with. Generally, monikers look as follows: "object moniker"!"object prefix"!Trans!"transformation type"!"transformation key"!"postfix".
Where:
"object moniker". Moniker of the object, in which work with expression is executed. Work with expressions can be executed in ETL task objects, analytical data area, on working with pages of regular reports, express reports, workbooks, in wizards of cubes, dictionaries and tables.
"object prefix". Prefix that specifies object type. Available values:
Eax. Express reports.
Laner. Workbooks.
"transformation type". It depends on the value of created expression. Available values:
Calc. Value calculation expression.
Sort. Sorting expression.
Filter. Filtering expression.
"transformation key". Transformation key can be obtained in metadata of the object, with which work is executed.
"postfix". It is added depending on the specified moniker. Available values:
Exp. For the tExpressionId moniker.
TermProv. For the tTermProviderId moniker.
The following key is sued on working with ETL task: 'ETL task moniker'!Objects!'object index'!Exp'Input/output index'.
Operation execution parameters are specified in tOperations, and terms and parameters for creating forms that will be used on operation execution are specified in tExpressionAgrs.
The operation results in the formed internal term views that can be used to create expressions, or information about errors if incorrect term data is specified.
Below is the example of using the SetExp operation for processing term set and for forming a new term by the operation about dimension element. The request contains a term set and parameters for creating a new term. The response contains formed internal term views and information about a new term.
{ "SetExp" : { "tExpressionId" : { "id" : "S1!M!S!E2!Eax!Trans!Calc!18590!Exp" }, "tTermProviderId" : { "id" : "S1!M!S!E2!Eax!Trans!Calc!18590!TermProv" }, "tOperations" : { "meta" : { "Terms" : "true", "IsValid" : "true", "NewTerm" : "true" }, "metaGet" : { "Terms" : "true", "IsValid" : "true", "bErrorMessage" : "true", "bErrorPosition" : "true", "NewTerm" : "true" } }, "tExpressionAgrs" : { "Terms" : { "terms" : { "Item" : [ { "sText" : "{Item 1[t]}" }, { "sText" : "+" }, { "sText" : "{Item 2[t]}" } ] } }, "NewTermParams" : { "it" : [ { "n" : "tag", "v" : "eax.de" }, { "n" : "key", "v" : "116" }, { "n" : "elKey", "v" : "3" } ] }, "InsertNewTermAt" : "0" } } }
{ "SetExpResult" : { "Terms" : { "terms" : { "Item" : [ { "bIsLiteral" : "0", "sText" : "{Item 1[t]}", "sFormula" : "@_18644:0[]", "sParseableText" : "{Item 1[t]}" }, { "bIsLiteral" : "1", "sText" : " + ", "sFormula" : " + ", "sParseableText" : " + " }, { "bIsLiteral" : "0", "sText" : "{Item 2[t]}", "sFormula" : "@_18645:0[]", "sParseableText" : "{Item 2[t]}" } ] } }, "bIsValid" : "1", "NewTerm" : { "bIsLiteral" : "0", "sText" : "Item 3", "sFormula" : "@__1" } } }
public static ExpressionResult SetExpression(EaxId moniker, ulong transformKey)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetExp()
{
tExpressionId = new ExpressionId() { id = moniker.id + "!Eax!Trans!Calc!" + transformKey.ToString() + "!Exp" },
tTermProviderId = new TermProviderId() { id = moniker.id + "!Eax!Trans!Calc!" + transformKey.ToString() + "!TermProv" },
tOperations = new ExpOperations()
{
meta = new ExpMetaOperations()
{
Terms = true,
NewTerm = true,
IsValid = true
},
metaGet = new ExpMetaOperationsPattern()
{
Terms = true,
NewTerm = true,
IsValid = true,
bErrorMessage = true,
bErrorPosition = true
}
},
tExpressionAgrs = new ExpressionArgs()
{
Terms = new ExpressionTerms()
{
terms = new ExpressionTerm[]
{
new ExpressionTerm() { sText = "{First element[t]}" },
new ExpressionTerm() { sText = "+" },
new ExpressionTerm() { sText = "{Second element[t]}" }
}
},
NewTermParams = new TreeTermParam[]
{
new TreeTermParam() { n = "tag", v = "eax.de" },
new TreeTermParam() { n = "key", v = "116" },
new TreeTermParam() { n = "elKey", v = "3" },
},
InsertNewTermAt = 0
}
};
//Handle terms
var result = somClient.SetExp(tSet);
return result;
}
See also: