SetDmCalc

Syntax

DmCalcResult SetDmCalc(DmId tDim, SetDmCalcArg tArg)

Parameters

tDim. Calculated dictionary instance moniker.

tArg. Operation execution parameters.

Description

The SetDmCalc operation changes calculated dictionary metadata.

Comments

This operation enables the user to change calculated dictionary structure: attributes, blocks, indexes, dictionary levels, macro for building an element tree and other settings that affect dictionary work. A calculated dictionary should be opened for edit. To execute the operation, in the tDim field specify calculated dictionary instance moniker, and in the tArg field specify change parameters. The moniker can be obtained on executing the OpenDim operation. In the tArg.pattern field specify the pattern that will be used to make changes, and in the tArg.args field specify changed metadata. After making changes save the dictionary by using the SaveObject or SaveObjectAs operation. The operation results in the updated metadata if the tArg.metaGet pattern was specified.

Example

Below is the example of using the SetDmCalc operation to change calculated dictionary structure, that is, a new attribute is added to the dictionary. The request contains the dictionary moniker, the pattern that determines whether it is necessary to add a new attribute, and metadata with specified new attribute parameters. The response contains updated information about all dictionary attributes.

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">
<SetDmCalc xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDim xmlns="">
  <id>S1!M!S!DM1</id>
  </tDim>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <attributes>Add</attributes>
  </pattern>
<args>
<attributes>
<attributes>
<it>
  <k>18446744073709551615</k>
  <name>Additional value</name>
  <id>ADDITIONAL</id>
  <dataType>3</dataType>
  </it>
  </attributes>
  </attributes>
  </args>
<metaGet>
  <obInst>true</obInst>
  <attributes>Get</attributes>
  </metaGet>
  </tArg>
  </SetDmCalc>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetDmCalcResult 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">
<id xmlns="">
  <id>S1!M!S!DM1</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="6" hf="0">
  <i>DIM_CALC</i>
  <n>Dictionary</n>
  <k>175067</k>
  <c>1027</c>
  <p>175063</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<attributes>
<attributes>
<it>
  <k>1</k>
  <name>Name</name>
  <id>NAME</id>
  <dataType>1</dataType>
  <visible>1</visible>
  <nameDest>1</nameDest>
  <hasHierarchy>0</hasHierarchy>
<order>
  <pattern>None</pattern>
  </order>
  </it>
<it>
  <k>2</k>
  <name>Identifier</name>
  <id>ID</id>
  <dataType>2</dataType>
  <visible>1</visible>
  <idDest>1</idDest>
  <hasHierarchy>0</hasHierarchy>
<order>
  <pattern>None</pattern>
  </order>
  </it>
<it>
  <k>3</k>
  <name>Order</name>
  <id>ORDER</id>
  <dataType>2</dataType>
  <visible>1</visible>
  <hasHierarchy>0</hasHierarchy>
<order>
  <pattern>Get</pattern>
  <reverse>0</reverse>
  <index>0</index>
  </order>
  </it>
<it>
  <k>4</k>
  <name>Additional value</name>
  <id>ADDITIONAL</id>
  <dataType>3</dataType>
  <visible>1</visible>
  <hasHierarchy>0</hasHierarchy>
<order>
  <pattern>None</pattern>
  </order>
  </it>
  </attributes>
  <hideInaccessible>1</hideInaccessible>
  </attributes>
  </meta>
  </SetDmCalcResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetDmCalc" :
{
"tDim" :
{
"id" : "S1!M!S!DM1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"attributes" : "Add"
},
"args" :
{
"attributes" :
{
"attributes" :
{
"it" :
{
"k" : "18446744073709551615",
"name" : "Additional value",
"id" : "ADDITIONAL",
"dataType" : "3"
}
}
}
},
"metaGet" :
{
"obInst" : "true",
"attributes" : "Get"
}
}
}
}

JSON response:

{
"SetDmCalcResult" :
{
"id" :
{
"id" : "S1!M!S!DM1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "6",
"@hf" : "0",
"i" : "DIM_CALC",
"n" : "Dictionary",
"k" : "175067",
"c" : "1027",
"p" : "175063",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"attributes" :
{
"attributes" :
{
"it" :
[
{
"k" : "1",
"name" : "Name",
"id" : "NAME",
"dataType" : "1",
"visible" : "1",
"nameDest" : "1",
"hasHierarchy" : "0",
"order" :
{
"pattern" : "None"
}
},
{
"k" : "2",
"name" : "Identifier",
"id" : "ID",
"dataType" : "2",
"visible" : "1",
"idDest" : "1",
"hasHierarchy" : "0",
"order" :
{
"pattern" : "None"
}
},
{
"k" : "3",
"name" : "Order",
"id" : "ORDER",
"dataType" : "2",
"visible" : "1",
"hasHierarchy" : "0",
"order" :
{
"pattern" : "Get",
"reverse" : "0",
"index" : "0"
}
},
{
"k" : "4",
"name" : "Additional value",
"id" : "ADDITIONAL",
"dataType" : "3",
"visible" : "1",
"hasHierarchy" : "0",
"order" :
{
"pattern" : "None"
}
}
]
},
"hideInaccessible" : "1"
}
}
}
}
public static GetDmCalcResult ChangeUserDimension(DmId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetDmCalc()
{
tArg = new SetDmCalcArg()
{
pattern = new DmCalcMdPattern()
{
attributes = ListOperation.Add
},
args = new DmCalcMd()
{
attributes= new DmCalcAttributes()
{
attributes = new DmCalcAttribute[]
{
new DmCalcAttribute()
{
id = "ADDITIONAL",
name = "Additional value",
dataType = 3, //DbDataType.Float
k = ulong.MaxValue
}
}
}
},
metaGet = new DmCalcMdPattern()
{
attributes = ListOperation.Get
}
},
tDim = moniker
};
//Change calculated dictionary
var result = somClient.SetDmCalc(tSet);
return result;
}

See also:

Working with Dictionaries