System Library: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
* ML | * ML | ||
** [[Create Predicted Eventlog|GeneratePredictionModel]] | ** [[Create Predicted Eventlog|GeneratePredictionModel]] | ||
** [[Create Simulated Eventlog|ApplyTransformations]] | ** [[Create Simulated Eventlog|ApplyTransformations]] | ||
* Parallel | * Parallel | ||
Line 27: | Line 26: | ||
The following script uses _system.Parallel.Run to run three functions: | The following script uses _system.Parallel.Run to run three functions: | ||
* SAP-extraction from VBAK-table in SAP | * SAP-extraction from VBAK-table in SAP (connection parameters defined in connectionParametersDict-dictionary). | ||
* Transform the extracted data by adding a new column. | * Transform the extracted data by adding a new column. | ||
* Load the data into data table identified by dataTableId. | * Load the data into data table identified by dataTableId. | ||
Line 59: | Line 58: | ||
ExtractTransformAndLoad( | ExtractTransformAndLoad( | ||
() => ExtractSap( | () => ExtractSap(connectionParametersDict.Extend( | ||
[ | [ | ||
"FieldNames": "VBELN,ERDAT,ERZET,ERNAM,NETWR,WAERK", | "FieldNames": "VBELN,ERDAT,ERZET,ERNAM,NETWR,WAERK", | ||
Line 69: | Line 68: | ||
df => df.SetColumns(["Test": () => `${Column("NETWR")} ${Column("WAERK")}`]), | df => df.SetColumns(["Test": () => `${Column("NETWR")} ${Column("WAERK")}`]), | ||
dataFlow => { | dataFlow => { | ||
DataTableById( | DataTableById(dataTableId).Import(dataFlow, ["Append": 0]); | ||
} | } | ||
); | ); | ||
DataTableById( | DataTableById(dataTableId).SqlDataFrame.OrderByColumns(["VBELN"], [true]).Collect() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 10:24, 19 November 2024
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