SetExp

Syntax

GetTreeElementsResult SetExp(

ExpressionId tExpressionId,

TermProviderId tTermProviderId,

ExpOperations tOperations,

ExpressionArgs tExpressionAgrs)

Parameters

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.

Description

The SetExp operation is used to form terms by the sent information.

Comments

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:

The following key is sued on working with ETL task: 'ETL task moniker'!Objects!'object index'!Exp'Input/output index'.

On working with calculated cube formulas, the following moniker is in use: "calculated cube instance moniker"!keyDim1.element0|keyDim2.element1|keyDimn.elementm!ExpN, where keyDim1, keyDim2, keyDimn are dimension keys; element0, element1, elementm - elements indexes in dimensions. The dimensions keys and elements indexes creates a coordinates that sets formula in calculated cube. ExpN - formula index, if management of formula actual period is activated in cube. Indexing starts with 0.

On settings up filtering for relational object: "moniker form the cachedDatasetId field!FILTER.

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.

Example

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetExp xmlns="http://www.fsight.ru/PP.SOM.Som">
<tExpressionId xmlns="">
  <id>S1!M!S!E2!Eax!Trans!Calc!18590!Exp</id>
  </tExpressionId>
<tTermProviderId xmlns="">
  <id>S1!M!S!E2!Eax!Trans!Calc!18590!TermProv</id>
  </tTermProviderId>
<tOperations xmlns="">
<meta>
  <Terms>true</Terms>
  <IsValid>true</IsValid>
  <NewTerm>true</NewTerm>
  </meta>
<metaGet>
  <Terms>true</Terms>
  <IsValid>true</IsValid>
  <bErrorMessage>true</bErrorMessage>
  <bErrorPosition>true</bErrorPosition>
  <NewTerm>true</NewTerm>
  </metaGet>
  </tOperations>
<tExpressionAgrs xmlns="">
<Terms>
<terms>
<Item>
  <sText>{Item 1[t]}</sText>
  </Item>
<Item>
  <sText>+</sText>
  </Item>
<Item>
  <sText>{Item 2[t]}</sText>
  </Item>
  </terms>
  </Terms>
<NewTermParams>
<it>
  <n>tag</n>
  <v>eax.de</v>
  </it>
<it>
  <n>key</n>
  <v>116</v>
  </it>
<it>
  <n>elKey</n>
  <v>3</v>
  </it>
  </NewTermParams>
  <InsertNewTermAt>0</InsertNewTermAt>
  </tExpressionAgrs>
  </SetExp>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetExpResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Terms xmlns="">
<terms>
<Item>
  <bIsLiteral>0</bIsLiteral>
  <sText>{Item 1[t]}</sText>
  <sFormula>@_18644:0[]</sFormula>
  <sParseableText>{Item 1[t]}</sParseableText>
  </Item>
<Item>
  <bIsLiteral>1</bIsLiteral>
  <sText> + </sText>
  <sFormula> + </sFormula>
  <sParseableText> + </sParseableText>
  </Item>
<Item>
  <bIsLiteral>0</bIsLiteral>
  <sText>{Item 2[t]}</sText>
  <sFormula>@_18645:0[]</sFormula>
  <sParseableText>{Item 2[t]}</sParseableText>
  </Item>
  </terms>
  </Terms>
  <bIsValid xmlns="">1</bIsValid>
<NewTerm xmlns="">
  <bIsLiteral>0</bIsLiteral>
  <sText>Item 3</sText>
  <sFormula>@__1</sFormula>
  </NewTerm>
  </SetExpResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
 "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"
    }
  }
}

JSON response:

{
 "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:

Specific Operations