Plug-in Reference — Inline Functions — Editor_Join

# Editor_Join

Combines two CSV documents specifying key columns, using a method similar to JOIN operations, and creates a new document. You can use this inline function or explicitly send the EE_JOIN message.

Editor_Join( HWND hwnd, UINT nFlags, LPCWSTR pszDocument1, LPCWSTR pszColumn1, LPCWSTR pszDocument2, LPCWSTR pszColumn2, LPCWSTR pszSelect, int* piDocument3 );

## Parameters

hwnd

Specifies the window handle of the view or frame of EmEditor.

nFlags

You can specify a combination of the following values.

JOIN_FLAG_UNIQUE_KEY_1 | The specified column in the first document contains a unique key.
JOIN_FLAG_UNIQUE_KEY_2 | The specified column in the second document contains a unique key.
JOIN_FLAG_INCLUDE_ALL_1 | 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.
JOIN_FLAG_INCLUDE_ALL_2 | 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.
JOIN_FLAG_MATCH_CASE | Matches cases.
JOIN_FLAG_SIMPLE_JOIN | Merge two documents without comparing keys. If this is specified, pszColumn1 and pszColumn2 parameters are ignored.
JOIN_FLAG_IGNORE_HEADINGS_1 | Ignore headings in the first document so that headings from the first document are retained in the merged document.
JOIN_FLAG_IGNORE_HEADINGS_2 | Ignore headings in the second document.
JOIN_FLAG_CONTAIN | Key1 contains Key2.
JOIN_FLAG_START_WITH | Key1 starts with Key2.
JOIN_FLAG_END_WITH | Key1 ends with Key2.
JOIN_FLAG_MATCH_SPLIT_BOTH | Both split strings match.
JOIN_FLAG_MATCH_SPLIT_ONE | Key1 matches split Key2.
JOIN_FLAG_FUZZY | Uses fuzzy matching. This flag cannot be combined with JOIN_FLAG_END_WITH, JOIN_FLAG_MATCH_SPLIT_BOTH, or JOIN_FLAG_MATCH_SPLIT_ONE. This flag makes the process slower.
JOIN_FLAG_SWAP | Swaps Key1 and Key2 if JOIN_FLAG_CONTAIN, JOIN_FLAG_START_WITH, or JOIN_FLAG_END_WITH is also specified.

pszDocument1

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", or ":2".

pszColumn1

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".

pszDocument2

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

pszColumn2

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

pszSelect

Specifies the string to select which columns to include in the output document. For example, "file1.csv>column1,file2.csv>column2".

piDocument3

This field will be filled with the index of the output document when the function returns. If this is NULL, this field will be ignored.

## Return Values

The return value is the number of the lines in the new document. The return value is a negative value if an error occurs. If an error occurs, the return value can be one of the following values:

E_DOCUMENT_1_NOT_FOUND | Cannot find the first document.
E_DOCUMENT_2_NOT_FOUND | Cannot find the second document.
E_COLUMN_1_NOT_FOUND | Cannot find the first column.
E_COLUMN_2_NOT_FOUND | Cannot find the second column.
E_SELECT_SYNTAX | Syntax error in the Select string.
E_SELECT_DOCUMENT_NOT_FOUND | Cannot find a specified document in the Select string.
E_SELECT_COLUMN_NOT_FOUND | Cannot find a specified column in the Select string.
E_DIFFERENT_CSV_MODE | Different CSV modes.
E_NOT_MDI | Tabs must be enabled.
E_WRITE_TEMP_FILE | Temporary file write error.
E_ABORT | Aborted by a user.
E_FAIL | Unspecified error.

## Version

Supported on EmEditor Professional Version 14.8 or later.