When you define the "Input Data Record
Structure" in the Wedge, you first define the events that determine the start and the
end of each data record. You then define how you want the Wedge to parse each data record
by selecting a "Record Structure". You can have it parse your data records based
on either the positions of delimiter characters within each record or by byte position in
the record. The Wedge always stops reading in data when it encounters the specific
"End Of Record Event" that you specify. If you define more data fields than are
actually present in the data record then the remaining fields will be left empty. You
could take advantage of additional empty data fields by using them to perform calculations
on previous data fields using a "Math Expression" in the empty fields. For
example suppose that you had a device that transmitted a pair of numbers, X1 and X2, in
the following comma delimited format with a carriage return at the end of the data record:
X1,X2<Cr>
Suppose also that you wanted to pass these two numbers to
another program along with the difference between the two numbers. To do this, you could
define the input data record structure by specifying the End Of Record Event as
"Carriage Return or CrLf Received" and then specifying the "Record
Structure" as "Multiple Delimited Data Fields" with a comma as the
delimiter and specifying three for the maximum number of data fields. The actual
data has only two data fields before the carriage return so by specifying three for the
maximum number of fields, you will end up with a third empty data field in the Wedge. For
each field that you define in the Wedge, you can also define a Math Expression to be
applied to the field. Math expressions in the Wedge can contain references to previous
data fields by using the "Field(n)" expression. If you specified "Field(2)
- Field(1)" for the math expression for Field(3) (the empty field), then you would
end up with the difference between the two numbers X1 and X2 in Field(3) in the Wedge.
More Cool Wedge Tricks
|