Skip to main content Skip to complementary content

Setting a byte offset in a flat structure

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

  1. Open the Util tab for the c element.
  2. Drag and drop a SetElementProperty function in the Util tab.
  3. Drag and drop an Add function on the Value argument.
  4. Drag and drop a GetElementProperty function on the First Value argument.
  5. Double-click the GetElementProperty function and select Byte offset in the Property drop-down list, then click OK.
  6. Drag and drop the c element on the Element argument of the GetElementProperty function.
  7. Drag and drop a Constant function on the Second Value argument.
  8. 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!