System Library
Jump to navigation
Jump to search
System library is a collection of Expression Language functions and properties that provide additional tools for scripting Process Analyzer functionalities. System library is referenced in scripts via _system-property, which provides additional properties dedicated for different areas of interests for scripting.
The following hierarchy shows the properties and functions available in System Library:
- ML
- Parallel
- Run
- RootCauses
- FindRootCausesDataFrame
- Utils
- GetSampledEvents
- ModifyColumnTypes
- RunFunctionWithParallelLogging
Parallel.Run
Runs given functions in parallel.
Parameters
- functions:
- An array of functions to run in parallel.
Example
The following script uses _system.Parallel.Run to run three functions:
- SAP-extraction from VBAK-table in SAP (connection parameters defined in connectionParametersDict-dictionary).
- Transform the extracted data by adding a new column.
- Load the data into data table identified by dataTableId.
function ExtractTransformAndLoad(extractFunc, transformFunc, loadFunc)
{
let rawDataFlow = extractFunc();
let transformedDataFlow = ToDataFlow();
_system.Parallel.Run([
() => Catch({
let df;
while (!IsNullTop(df = rawDataFlow.Collect(#{"CollectChunk": true}))) {
transformedDataFlow.Append(transformFunc(df));
WriteLog(`A chunk having ${df.NRows} rows has been transformed.`);
}
if (rawDataFlow.HasError) {
transformedDataFlow.Fail("Error occurred during data extraction.");
}
else {
transformedDataFlow.Complete();
}
}, {
transformedDataFlow.Fail("Error occurred during transformation calculation.");
}),
() => {
loadFunc(transformedDataFlow);
}
]);
}
ExtractTransformAndLoad(
() => ExtractSap(connectionParametersDict.Extend(
[
"FieldNames": "VBELN,ERDAT,ERZET,ERNAM,NETWR,WAERK",
"QueryTable": "VBAK",
"Options": ["VBELN BETWEEN '0000017448'" ,"AND '0060000042'"],
"UseGateway": true
])
),
df => df.SetColumns(["Test": () => `${Column("NETWR")} ${Column("WAERK")}`]),
dataFlow => {
DataTableById(dataTableId).Import(dataFlow, ["Append": 0]);
}
);
DataTableById(dataTableId).SqlDataFrame.OrderByColumns(["VBELN"], [true]).Collect()
RootCauses.FindRootCausesDataFrame
foo
Utils.GetSampledEvents
foo
Utils.RunFunctionWithParallelLogging
foo