Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WDESIGNER and version 24.0

For parsing and composing flat files there is a set of counters and related macros available that provide extended features.

TypeParseComposeDescriptionID
automatic counters(tick)(tick)Eight automatic counters that can be accessed via their IDs AUTO0 .. AUTO7.AUTO0 .. AUTO7
automatic line counters(tick)(error)Two automatic line counters that can be accessed via their IDs LINE0 and LINE1.LINE0, LINE1
custom counters(tick)(tick)Unlimited custom counters that can be accessed via their IDs CUSTOM0 .. CUSTOMx.CUSTOM0 .. CUSTOMx

You cannot access these counters directly but only via the macro expressions listed in the table below. Macro expressions referring to one of the counters can be specified on flat file records and on flat file properties (see also Defining a Flat File Data Structure) in the stereotype attributes parseMacro and composeMAcro.

  • When parsing/composing the first record, all counters have the initial value of 0.
  • Automatic counters automatically increase with each processed record.
  • Custom counters have to be increased manually using the IncreaseCounter() macro (see below).

The counters can be handled using the following macros:

MacroAvailable onAvailable
for
DescriptionExample

ResetCounter(ID[, Value])

Record
Property

AUTO
CUSTOM

Reset the counter ID to 0 or a given Value.

ResetCounter(AUTO0)
ResetCounter(AUTO0, 1)

IncreaseCounter(ID)

Record
Property
AUTO
CUSTOM

Increases the counter ID by 1.

IncreaseCounter(CUSTOM2)

GetCounter(ID)

PropertyAUTO
LINE
CUSTOM

Read the value of a counter and store it to the current attribute.

GetCounter(LINE0)

VerifyCounter(ID)

PropertyAUTO
LINE
CUSTOM

Compare the value of a counter with the current attribute. This macro will throw an exception if the values are not equal.

VerifyCounter(CUSTOM0)
Info

For GetCounter() and VerifyCounter() only attributes of type Integer are supported.

Example

The Flat File adapter example shows the usage of an automatic counter to provide a line number to the data records during the composing process. Refer to Defining a Flat File Data Structure for more details on the example flat file.

  • Property line stores the number of the product line by using GetCounter(AUTO0).
  • With every Header record, the counter gets reset to 0  by using ResetCounter(AUTO0). This way the header record will not be counted.

The picture below shows the composing process for the example with emphasis on macro execution.

Panel
titleOn this Page:
Table of Contents
OtpFloatingfalse

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameFlatFileAdapter_ProductExport_Example
PageWithExcerptINTERNAL:_designer_examples
shouldDisplayInlineCommentsInIncludesfalse

rp
Panel
titleRelated Pages: