ForeExecResult ForeExecWithState(ForeId tFore, ForeExecArg tArg, ForeExecStateArg tStateArg)
tFore. Moniker.
tArg. Operation execution parameters.
tStateArg. Parameters for saving objects on state server.
The ForeExecWithState operation executes methods implemented in Fore units with subsequent saving of objects on state server.
The state server should be first installed and configured to work with BI server.
To execute the operation, in the tFore field specify moniker of the unit, assembly that contains implementation of the executed method. The moniker can be obtained on executing the GetObjects operation. In the tArg.methodName field specify name of the method to be executed, and in the tArg.args field specify values of the method input parameters. In the tArg.tStateArg field specify parameters for saving objects on state server.
The operation should meet all requirements, features and recommendations that the ForeExec operation has.
Below is the example of executing the method with sending repository objects as parameter values. The request contains name of the executed method and moniker of the development environment object containing method implementation. Parameter values contain repository connection monikers and moniker of opened instance of express report. After executing the method, the express report state will be saved on the state server. The executed method has the following syntax:
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"ForeExecWithState" :
{
"tFore" :
{
"id" : "CJHOLKCMALALFOAEKGINPHCCMHHOLIHEBJLCOLDNKEKMKCKG!M!7360"
},
"tArg" :
{
"methodName" : "WorkWithObject",
"args" :
{
"it" :
[
{
"k" : "1",
"value" : "CJHOLKCMALALFOAEKGINPHCCMHHOLIHEBJLCOLDNKEKMKCKG!M"
},
{
"k" : "2",
"value" : "CJHOLKCMALALFOAEKGINPHCCMHHOLIHEBJLCOLDNKEKMKCKG!M!S!ENPDFCNCMALALFOAEBIAIIOLLHIEDGGIEAKNLNKCFNJJDEKLP"
}
]
}
},
"tStateArg" :
{
"saveState" : "true",
"objectsToSave" :
{
"s" : "CJHOLKCMALALFOAEKGINPHCCMHHOLIHEBJLCOLDNKEKMKCKG!M!S!ENPDFCNCMALALFOAEBIAIIOLLHIEDGGIEAKNLNKCFNJJDEKLP"
}
}
}
}
{
"ForeExecWithStateResult" :
{
"result" : ""
}
}
public static ForeExecResult ExecMethodWithState(MbId mb, string assmId, string methodName, string objMoniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tExec = new ForeExecWithState()
{
tArg = new ForeExecArg()
{
methodName = methodName,
//Monikers as parameters values
args = new OdArg[2]
{
new OdArg(){ k = 1, value = mb.id },
new OdArg(){ k = 2, value = objMoniker }
}
},
//Moniker of development environment object with method implementation
tFore = new ForeId()
{
id = mb.id + "!" + FindObjectById(mb, assmId).k
},
tStateArg = new ForeExecStateArg()
{
saveState = true,
objectsToSave = new string[] { objMoniker }
}
};
//Execute method and save object state
var result = somClient.ForeExecWithState(tExec);
return result;
}
See also: