New archived content: Talend MDM, Talend Data Catalog 8.0, and Talend 7.3 products reached their end of life in 2024. Their documentation was moved to the Talend Archive page and will no longer receive content updates.
Use a SetElementProperty and a
GetElementProperty function to edit a byte offset in an
element.
Before you begin
You have created a flat structure.
About this task
In this example, you have a flat file with a root element and three child elements
named a, b and c, with the following sample
data:
A1111B2222C00003333
Each child element has an initiator,
A, B and C respectively. The goal is to
configure the c element to ignore the 0000 part of the value.
Procedure
Open the Util tab for the c element.
Drag and drop a SetElementProperty function in the
Util tab.
Drag and drop an Add function on the
Value argument.
Drag and drop a GetElementProperty function on the
First Value argument.
Double-click the GetElementProperty function and select
Byte offset in the Property drop-down
list, then click OK.
Drag and drop the c element on the Element
argument of the GetElementProperty function.
Drag and drop a Constant function on the Second
Value argument.
Double-click the Constant
function and enter 4 in the Value field, then click OK.
Results
The expression created indicates that the byte offset for the c
elements should be calculated by adding the four bytes to ignore to the current offset of the
c element, which is called by the GetElementProperty element.
If you want to check that the new offset is correct, you can create a map with this
structure as both input and output.
When using the Test Run feature, you should get the
following result:
A1111B2222C3333
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!