From 019a20a38d67a8c82922af6c7483e0944caaaddb Mon Sep 17 00:00:00 2001 From: xPAGCOE <113696274+xPAGCOE@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:00:42 +0100 Subject: [PATCH] Add files via upload --- SAC DataFrame/sacdataframe.js | 19 +++++++++++++++++++ SAC DataFrame/sacdataframe.json | 10 +++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SAC DataFrame/sacdataframe.js b/SAC DataFrame/sacdataframe.js index 6a0202a..db6012f 100644 --- a/SAC DataFrame/sacdataframe.js +++ b/SAC DataFrame/sacdataframe.js @@ -628,6 +628,25 @@ var getScriptPromisify = (src) => { return df; } + + // Merge + merge(dataframe_1, dataframe_2, on_columns, merging_mode) { + + var df1 = null; + var df2 = null; + var df = null; + + if((dataframe_1 != null) && (dataframe_2 != null)) { + + df1 = this.newDataFrame(dataframe_1.$data, {columns: dataframe_1.$columns}); + df2 = this.newDataFrame(dataframe_2.$data, {columns: dataframe_2.$columns}); + + df = this.dfd.merge({ left: df1, right: df2, on: on_columns, how: merging_mode}); + + } + + return df; + } } window.customElements.define('com-sap-sample-sacdataframe', SACDataFrame); diff --git a/SAC DataFrame/sacdataframe.json b/SAC DataFrame/sacdataframe.json index 885699c..dbd09d9 100644 --- a/SAC DataFrame/sacdataframe.json +++ b/SAC DataFrame/sacdataframe.json @@ -3,7 +3,7 @@ "vendor": "SAP", "license": "", "id": "com.sap.sample.sacdataframe", - "version": "0.0.8", + "version": "0.0.9", "name": "JavaScript DataFrame for SAC", "newInstancePrefix": "SACDataFrame", "description": "A widget that provides DataFrame-like functions", @@ -222,6 +222,14 @@ "description": "Concatenate DataFrames along an axis", "parameters": [ {"name": "dataframes", "type": "Selection[]", "description": "Array of DafaFrames to concatenate"}, {"name": "axis", "type": "integer", "description": "0 for row, 1 for column"} ] + }, + "merge": { + "returnType": "Selection", + "description": "Merge DataFrame with a database-style join done on columns or indexes", + "parameters": [ {"name": "dataframe_1", "type": "Selection", "description": "First DataFrame"}, + {"name": "dataframe_2", "type": "Selection", "description": "Second DataFrame"}, + {"name": "on_columns", "type": "string[]", "description": "Column names to join on. Must be found in both the left and right DataFrame"}, + {"name": "merging_mode", "type": "string", "description": "Merging mode as 'left','right','outer', 'inner' with defaults to 'inner'"} ] } }, "events": {