Opening and Getting Metadata

Below is the example of using the OpenAlg operation to create a calculation block and get its metadata. The request contains moniker of the object that is a repository calculation block. The response contains moniker of opened instance and requested metadata.

The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.

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">
<OpenAlg xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!231308</id>
  </tOb>
<tArg xmlns="">
<args>
  <openForEdit>true</openForEdit>
  </args>
<metaGet>
  <obInst>true</obInst>
<calcBlock>
<dest>
  <stub>true</stub>
  <linksOperation>Get</linksOperation>
  </dest>
  </calcBlock>
  </metaGet>
  </tArg>
  </OpenAlg>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenAlgResult 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!C2</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="5" hf="0">
  <i>CALC_BLOCK</i>
  <n>Calculation block</n>
  <k>231308</k>
  <c>1709825</c>
  <p>231226</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<calcObject>
  <k>231308</k>
  <id>CALC_BLOCK</id>
  <n>Calculation block</n>
  <vis>1</vis>
  <type>CalcBlock</type>
<calcBlock>
<dest>
  <k>231304</k>
  <id>OBJ231297</id>
  <n>Destination cube</n>
  <vis>1</vis>
<desc ds="" isShortcut="0" isLink="0" ver="2" hf="0">
  <i>OBJ231297</i>
  <n>Destination cube</n>
  <k>231304</k>
  <c>1281</c>
  <p>231293</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  </desc>
  <hasCalendar>1</hasCalendar>
  <useCalendarAsStubDimension>0</useCalendarAsStubDimension>
<links>
<its>
<it>
  <k>1</k>
<left>
  <dimId>FACTS</dimId>
  <attrId>KEY</attrId>
  <ignoreNulls>0</ignoreNulls>
  </left>
<right>
  <dimId>INDICATORS</dimId>
  <attrId>KEY</attrId>
  <ignoreNulls>1</ignoreNulls>
  </right>
  </it>
  </its>
  </links>
  <enabledRdsLinkButton>0</enabledRdsLinkButton>
  </dest>
  </calcBlock>
  </calcObject>
  </meta>
  <readOnly xmlns="">0</readOnly>
  </OpenAlgResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenAlg" :
{
"tOb" :
{
"id" : "S1!M!231308"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
},
"metaGet" :
{
"obInst" : "true",
"calcBlock" :
{
"dest" :
{
"stub" : "true",
"linksOperation" : "Get"
}
}
}
}
}
}

JSON response:

{
"OpenAlgResult" :
{
"id" :
{
"id" : "S1!M!S!C2"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "5",
"@hf" : "0",
"i" : "CALC_BLOCK",
"n" : "Calculation block",
"k" : "231308",
"c" : "1709825",
"p" : "231226",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"calcObject" :
{
"k" : "231308",
"id" : "CALC_BLOCK",
"n" : "Calculation block",
"vis" : "1",
"type" : "CalcBlock",
"calcBlock" :
{
"dest" :
{
"k" : "231304",
"id" : "OBJ231297",
"n" : "Destination cube",
"vis" : "1",
"desc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "OBJ231297",
"n" : "Destination cube",
"k" : "231304",
"c" : "1281",
"p" : "231293",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
},
"hasCalendar" : "1",
"useCalendarAsStubDimension" : "0",
"links" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"left" :
{
"dimId" : "FACTS",
"attrId" : "KEY",
"ignoreNulls" : "0"
},
"right" :
{
"dimId" : "INDICATORS",
"attrId" : "KEY",
"ignoreNulls" : "1"
}
}
]
}
},
"enabledRdsLinkButton" : "0"
}
}
}
},
"readOnly" : "0"
}
}
public static OpenAlgResult OpenAlgWithMetadata(MbId mb, string algId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenAlg()
{
tArg = new OpenAlgArg()
{
args = new AlgOpenArgs()
{
openForEdit = true
},
metaGet = new AlgMdPattern()
{
calcBlock = new AlgCalcBlockPattern()
{
dest = new AlgCalcBlockDestPattern()
{
stub = true,
linksOperation = ListOperation.Get
}
},
}
},
//Create object moniker
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, algId).k }
};
//Open with metadata request
var result = somClient.OpenAlg(tOpen);
return result;
}

See also:

OpenAlg: Operation