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.
{
"OpenAlg" :
{
"tOb" :
{
"id" : "S1!M!231308"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
},
"metaGet" :
{
"obInst" : "true",
"calcBlock" :
{
"dest" :
{
"stub" : "true",
"linksOperation" : "Get"
}
}
}
}
}
}
{
"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: