Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > Editor Object > Methods

EmEditor Macro Reference: Join Method

Scroll Prev Top Next More
EmEditor Home - EmEditor Help - EmEditor Macro Reference - Editor Object

Join Method

Combines two CSV documents specifying key columns, using a method similar to JOIN operations, and creates a new document.

[JavaScript]

n = editor.Join( nFlags, strDocument1, strColumn1, strDocument2, strColumn2, strSelect, strSeparator, nLimit );

[VBScript]

n = editor.Join( nFlags, strDocument1, strColumn1, strDocument2, strColumn2, strSelect, strSeparator, nLimit )

Parameters

nFlags

You can specify a combination of the following values. eeJoinSimpleMerge, eeJoinContain, eeJoinStartWith, and eeJoinEndWith cannot be combined.

eeJoinUniqueKey1

The specified column in the first document contains a unique key.

eeJoinUniqueKey2

The specified column in the second document contains a unique key.

eeJoinIncludeAll1

All lines in the first document should be included in the output. The output document will contain empty cells if lines in the first document do not have matches.

eeJoinIncludeAll2

All lines in the second document should be included in the output. The output document will contain empty cells if lines in the second document do not have matches.

eeJoinMatchCase

Matches cases.

eeJoinSimpleMerge

Merge two documents without comparing keys. If this is specified, strColumn1 and strColumn2 parameters are ignored.

eeJoinIgnoreHeadings1

Ignore headings in the first document so that headings from the first document are retained in the merged document.

eeJoinIgnoreHeadings2

Ignore headings in the second document.

eeJoinContain

Key1 contains Key2.

eeJoinStartWith

Key1 starts with Key2.

eeJoinEndWith

Key1 ends with Key2.

eeJoinMatchSplitBoth

Both split strings match.

eeJoinMatchSplitOne

Key1 matches split Key2.

eeJoinSwap

Swaps Key1 and Key2 if eeJoinContain, eeJoinStatWith, eeJoinEndWith, or eeJoinMatchSplitOne is also specified.

strDocument1

Specifies the string to identify the first document. This value can be a file name, file name with the full path, or a colon (:) followed by the index of the document in the current group. For example, "filename.csv", "C:\data\filename.csv" (in case of JavaScript, "C:\\data\\filename.csv"), or ":2".

strColumn1

Specifies the string to identify the key column of the first document. This value can be either the first line of the column or a colon (:) followed by the index of the column. For example, "first_name" or ":5".

strDocument2

Specifies the string to identify the second document. The format of this value is the same as strDocument1.

strColumn2

Specifies the string to identify the key column of the second document. The format of this value is the same as strColumn1.

strSelect

Specifies the string to select which columns to include in the output document. For example, "file1.csv>column1,file2.csv>column2". Use '+' instead of ',' to concatenate with the previous column, and '|' to use the first non-empty value.

strSeperator

Specifies a string as a separator when splitting a cell. This parameter is ignored unless eeJoinMatchSplitBoth or eeJoinMatchSplitOne is specified.

nLimit

Specifies the maximum number of splits per cell. If omitted or 0 is specified, the method will not limit the number of splits. This parameter is ignored unless eeJoinMatchSplitBoth or eeJoinMatchSplitOne is specified.

Return Values

The return value is the number of the lines that match the specified string.

Version

Supported on EmEditor Professional Version 14.8 or later.

Copyright © 2003-2021 by Emurasoft, Inc.