Loop by Number of Data

Operation name

Loop by Number of Data

Function overview

Repeats processing for the number of input data items.

Records are the loop unit when table model type data (database, Excel, etc.) is input.

Elements directly included in the element that acts as the base point of loop are the loop unit when XML type data is input.

Loop by Number of Data configuration

Icon

Name

Description

Start Loop by Number of Data

The start of Loop by Number of Data.

End Loop by Number of Data

The end of Loop by Number of Data.

Properties

= Remarks =

For details on use of variables, refer to Variables.

Basic settings

Item name

Required/Optional

Use of variables

Description

Remarks

Name

Required

Not available

Enter a name that is used on the script canvas.

 

Input data

Required

Not available

Select a component on the script canvas.

 

Required settings

Item name

Required/Optional

Use of variables

Description

Remarks

Number of data in one loop

Required

Available

Enter the number of data items for one loop.

  • The default value is 1.

XML data processing

Item name

Required/Optional

Use of variables

Description

Remarks

Separation path

Optional

Not available

Enter the path that acts as the base point of loop.

This field can be omitted when the input data is table model type.

 

Log settings

Item name

Required/Optional

Use of variables

Description

Remarks

Change log settings

Optional

Not available

Select whether or not to temporarily change the log settings of the loop operation.

Selected

Change the log settings.

Not selected

(Default)

Don't change the log settings.

 

Output log

Optional

Not available

Select whether or not to output logs.

Selected

(Default)

Output logs.

Not selected

Don't output logs.

  • Enabled when Change log settings is selected.

Log level

Optional

Not available

Select a log level to be set.

NOTICE
INFO

(Default)

FINFO
FINEST
DEBUG

  • Enabled when Output log is selected.

Comment

Item name

Required/Optional

Use of variables

Description

Remarks

Comment

Optional

Not available

You can write a short description of this connector.

 

Icon-click menu

Icon

Item name

Description

Remarks

Fold/Expand

Select + or - displayed on the icon.

Show/hide icons between Start Loop by Number of Data and End Loop by Number of Data.

When folded, only Start Loop by Number of Data is displayed.

Parallel Stream Processing

PSP is supported.

= Remarks =

For details on PSP, refer to Parallel Stream Processing.

Available component variables

Component variable name

Description

Remarks

count

The number of loops is stored.

  • The default value is null.

How to operate Loop by Number of Data

Creation of the Loop by Number of Data operation

Place operations that you want to repeat between Start Loop by Number of Data and End Loop by Number of Data.

Specification limits

  • If you change the log settings, the log level may change during multi-thread processing, such as PSP or the Thread operation.

  • The range of PSP with Smart Compiler is until the end of the loop operation.

Exception messages

None.

Notes

When Merge Mapper is selected as the input data

The output data of Merge Mapper is always XML type.

Therefore, when the data flow is connected to the Loop by Number of Data operation, it's necessary to specify Separation path as "/table/row" even if output schema is set as table model schema.

When writing operation of a file category connector is placed in the loop operation

When writing operation of a file category connector, such as the writing operation of the CSV connector, is placed in loop operation, the file to be written will be opened/closed at every loop. Therefore, the performance will degrade.

When writing operation of a file category connector is placed in loop operation, the open/close of the file to be written will be eliminated by enclosing the entire loop operation with transaction, and the performance degradation can be prevented.

 

The following script reads a CSV file and appends the data one by one to another CSV file with loop operation. Though the processing content is the same as a script consisting only of Read CSV File and Write CSV File, the performance will degrade.

 

Loop operation that degrades the performance

 

As shown in the following script, the performance degradation can be prevented by enclosing the entire loop operation with transaction.

Loop operation that prevents the performance degradation

Operation example

Using the Loop by Number of Data operation, create a script to execute the Read CSV File operation and the Write CSV File operation.

  1. Create a script as follows.

    The contents of the CSV file are as follows:

    id

    value

    S001

    10000

    S002

    20000

    S003

    30000

  2. The property settings for the Loop by Number of Data operation are as follows:

  3. Check the result in the execution log view after executing the script.

    The contents of the CSV file that were written by the Write CSV File operation are as follows:

    id

    value

    S001

    10000

    S002

    20000

    S003

    30000