MergeWorX CSV File Formats

MergeWorX processes new data as it receives it via CSV files that are identified in MergeWorX plug-ins. The following examples show the three CSV formats you can use with MergeWorX. These three formats can be combined within one CSV file, as long as the types are separated by one empty line. Syntax and examples are provided for Format Type 1, Format Type 2, and Format Type 3 later in this topic. But first there are a few things you should know about default values and DataPoints before you proceed.

Default Values for the CSV File

Before you begin, it is important to note that the following syntax requirements of the CSV file can be overridden for each plug-in:

  • The header line keys (DataPoint, Value, ValueType, Quality, and Timestamp) described below in this topic are the default keys that MergeWorX plug-ins look for. If a CSV file's header keys are different, you can map them using the plug-in's Advanced tab.

  • The default delimiter -- the Tab character -- can be overridden on a plug-in's General tab.

  • Providing quality codes in the CSV file is optional. If no quality code is provided in the CSV file, the default quality code defined on the plug-in's General tab is used.

  • Providing timestamps in the CSV file is optional. If no timestamp is provided in the CSV file, the current time is used.

  • Timestamps are assumed to be local unless otherwise specified on the plug-in's General tab.

For more information, refer to the Adding a Plug-in to the MergeWorX Configuration Database topic.

What is a DataPoint?

In the discussions that follow, DataPoint is a point name that identifies data. It has to match either the MergeWorX Tag input name or the Hyper Historian configuration tag‘s fully-qualified name.

When the MergeWorX engine receives data for a datapoint from a plug-in, it looks in the configuration to see if the plug-in has a tag with the same input name as the data point name.

  • If none is found, the output node from the plug-in configuration is added as a prefix and is written to the server.

  • If a match is found, the tag's output name is added an output node prefix and is used as the point identification in write request to the server.

For more information, refer to the Adding a Plug-in to the MergeWorX Configuration Database topic.

MergeWorX CSV Format Type 1

This first format type consists of a header definition line and data lines, where the Header defines the sequence of the columns to be provided.

Syntax

The header definition line looks like this:  

DataPoint,Value, ValueType, Quality, Timestamp

Example

Let's look at an example that formats the following data:

DataPoint

Timestamp

Quality

Value

ValueType

Hall1\PLC1\Temperature

2011-01-01 01:00:00.256 PM

0

10

Int32

Hall1\PLC2\Temperature

2011-01-01 01:00:00

134217728

Hall1\PLC1\Pressure

2011-01-01 01:00:10 AM

0

1.256

Double

In the CSV file, the data would look like this:

DataPoint, Value, ValueType, Quality, Timestamp

Hall1\PLC1\Temperature, 10, Int32, 0, 2011-01-01 01:00:00.256 PM

Hall1\PLC2\Temperature,  ,  , 134217728,

Hall1\PLC1\Pressure, 1.256, Double, 0, 2011-01-01 01:00:10 AM

MergeWorX CSV Format Type 2

The next format type consists of a point definition line, header definition line and data lines.

Syntax

The point definition line looks like this:

@DataPoint,PointName

The header definition line is:

Value, ValueType, Quality, Timestamp

Example

Let's look at an example that formats the following data:

@DataPoint

Hall1\PLC1\Temperature

Timestamp

Quality

Value

ValueType

2011-01-01 01:00:00

0

10

Int32

2011-01-01 02:00:00

134217728

In the CSV file, the data would look like this:

@DataPoint, Hall1\PLC1\Temperature  

Value, ValueType, Quality, Timestamp

10, Int32, 0, 2011-01-01 01:00:00

 , , 134217728, 2011-01-01 02:00:00

MergeWorX CSV Format Type 3

In this format, Types 1 and 2 are combined.

Syntax

The point definition line looks like this:

@DataPoint,PointName

The header definition line looks like this:

DataPoint,Value, ValueType, Quality, Timestamp

  • @DataPoint, PointName,DataPoint, and Value are required

  • ValueType, Quality, and Timestamp are optional

  • Refer to the following topics for more about: Timestamp format, ValueType, and Quality codes.

In this format, the PointName is a prefix to be appended to the beginning of all DataPoints that follow. You can use this format type for relative tag names or to build a hierarchy.

Example

Let's look at an example that formats the following data:

@DataPoint

Hall1\PLC1\

DataPoint

Timestamp

Quality

Value

ValueType

Temperature

2011-01-01 01:00:00

0

10

Int32

Pressure

2011-01-01 02:00:00

0

1.256

Double

In combining the @DataPoint of Hall1\PLC1\ with the DataPoint values of Temperature and Pressure, the resulting point names will be:

  • Hall1\PLC1\Temperature

  • Hall1\PLC1\Pressure

In the CSV file, the data would look like this:

@DataPoint, Hall1\PLC1  

DataPoint, Value, ValueType, Quality, Timestamp

Temperature, 10, Int32, 0, 2011-01-01 01:00:00

Pressure, 1.256, Double, 0, 2011-01-01 02:00:00

Timestamp formats

YYYY-M-D H:MI:S.MS or any standard format is acceptable. If the Timestamp field is empty, the server's current time is used as the timestamp.

ValueType

ValueType is defined by enum System.Runtime.InteropServices.TypeCode. The preferred way is to use string representation but numeric is also possible. If the ValueType field is empty, the MergeWorX engine tries to parse the value so that an appropriate value type can be assigned. If it cannot figure out an appropriate value type, the String type is assigned.

The following types are allowed:

Empty = 0,

Boolean = 3,

Char = 4,

SByte = 5,

Byte = 6,

Int16 = 7,

UInt16 = 8,

Int32 = 9,

UInt32 = 10,

Int64 = 11,

UInt64 = 12,

Single = 13,

Double = 14,

DateTime = 16,

String = 18,

Following types are not allowed. Using these results in a String value:

Object = 1,

DBNull = 2,

Decimal = 15,

Quality Codes

Quality codes are defined by class Ico.Fwx.Communication.Core.StatusCodes (Assembly FwxAsyncCore.dll). Quality has to be specified by numeric value. If the Quality field is empty, the default quality code defined in the plug-in configuration (on the General tab) is used. To see where the default quality code is defined, refer to the Adding a Plug-in to the MergeWorX Configuration Database topic.

The following codes are allowed:

Bad = 134217728;

BadCommunicationError = 2147483667;

BadConfigurationError = 2147483680;

BadContinuationPointInvalid = 2147483676;

BadInternalError = 2147483660;

BadInvalidArgument = 2147483674;

BadInvalidInParams = 2147483654;

BadInvalidMethodName = 2147483657;

BadInvalidOutParams = 2147483666;

BadInvalidPointHandle = 2147483651;

BadInvalidPointName = 2147483652;

BadInvalidProcedureName = 2147483687;

BadInvalidProperty = 2147483673;

BadInvalidRelativePath = 2147483683;

BadInvalidRequestCategory = 2147483649;

BadInvalidRequestType = 2147483650;

BadLicenseDemoOver = 2147483669;

BadLicenseDisabled = 2147483668;

BadLicenseError = 2147483670;

BadLicenseFailed = 2147483672;

BadLicensePointError = 2147483671;

BadMethodInvalid = 2147483657;

BadNoBound = 2147483684;

BadNoDataAvailable = 2147483662;

BadNodeIdInvalid = 2147483652;

BadNotImplemented = 2147483653;

BadNotSupported = 2147483682;

BadNotWritable = 2147483661;

BadProcedureStopped = 2147483688;

BadScalingFailed = 2147483686;

BadSecurityDisabled = 2147483685;

BadServerFailed = 2147483655;

BadTimeout = 2147483659;

BadTooManyOperations = 2147483664;

BadTypeMismatch = 2147483678;

BadUncertain = 3221225472;

BadUnexpectedError = 2147483656;

BadUnknownAggregateType = 2147483675;

BadUnknownTypeName = 2147483665;

BadUserAccessDenied = 2147483658;

BadWaitingForInitialData = 2147483663;

Good = 0;

GoodEntryInserted = 5;

GoodEntryReplaced = 6;

GoodLicenseDemo = 2;

GoodMoreData = 3;

GoodNoData = 4;

GoodWriteDropped = 1;

See also:

MergeWorX

MergeWorX Quick Start