From time to time, you may want to execute a livereport from an OScript function and get the results for further processing. This can be done quite easy.
First, you should have the node id of the report to execute.
In this scriptlet, the node id of this livereport to execute is nodeid
Second, you should setup a list with all input parameters. For each input parameter, create an assoc with inputType, label, prompt, textvalue and value of the parameter.
Add this assoc to the list of input parameters.
Store this list in the pExtendedData field of report node.
Object llnode = $LLiApi.LLNodeSubsystem.GetItem( $TypeReport ) Assoc data = llnode.ExecuteReport( prgCtx.fDBConnect, extdata )
Get the llnode of the report by calling the LLNodeSubSystem.GetItem. Execute the report by using llnode.ExecuteReport
The result of the livereport is in data.contents.
The whole call can look like this:
node = DAPI.GetNodeById(prgCtx.DapiSess(),nodeid) if node.pSubType == $TypeReport // Is node a livereport? Assoc extdata = node.pExtendedData Assoc inp //Create input parameters assoc Assoc inp inp.inputType = "String" inp.label = "inputlabel1" inp.prompt = "DataID" inp.textValue = Str.String ( DataID ) inp.value = Str.String ( DataID ) //Attach inputs parameters list to extendeddata List inputs = {inp} extdata.inputs = inputs llnode = $LLiApi.LLNodeSubSystem.GetItem($TypeReport) Assoc data = llnode.ExecuteReport(prgCtx.fDBConnect, extdata) result.OK=true result.data = data.contents return result end