Loop by Number of Data

Operation Name

Loop by Number of Data

Function Overview

Repeat processing for the input data number of times.
Record will be the loop unit when table model type data (database, Excel, etc.) is input.
All elements can be the loop unit when XML type data is input.

Loop by Number of Data Configuration

Icon Name Description
Start Loop by Number of Data Start of Loop by Number of Data.
End Loop by Number of Data End of Loop by Number of Data.

Properties

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 the name to show 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 for one loop.
  • 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.
Not needed 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 log settings of the loop processing.
  • [Checked]:
    Log settings will be changed.
  • [Not checked]: (default)
    Log settings will not be changed.
 
Output log Optional Not available Select whether or not to output log.
  • [Checked]: (default)
    Output log.
  • [Not checked]:
    Do not output log.
  • Enabled when [Change log settings] is checked.
Log level Optional Not available Select a log level to be set.
  • [NOTICE]:
  • [INFO]: (default)
  • [FINFO]:
  • [FINEST]:
  • [DEBUG]:
  • Enabled when [Output log] is checked.
Comment
Item name Required/Optional Use of variables Description Remarks
Comment Optional Not available You can write a short description of this adapter.
The description will be reflected in the specifications.
 

Right-click Menu

Icon Item name Description Remarks
Fold/Expand 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] will be displayed.

PSP Usage

PSP is supported.
Refer to “Parallel Stream Processing” for more details.

Available Component Variables

Component variable name Description Remarks
count The number of loops is stored.
  • Default value is null.

How to Operate Loop by Number of Data

Create Loop by Number of Data

Place operations to loop between [Start Loop by Number of Data] and [End Loop by Number of Data].



Specification Limits

Major Exceptions

None.

Notes

When Merge Mapper is selected as input data

Output data of Merge Mapper is always XML type.
Therefore, when the data flow is connected to Loop by Number of Data operation, it is necessary to specify [Separation path] as "/table/row" even if output schema is set as table model schema.

When writing operation of file category adapter is placed in loop processing

When writing operation of file category adapter, such as Write CSV File, is placed in loop operation, the file to be written will be opened/closed at every loop. Therefore, the performance will deteriorate.
When writing operation of file category adapter 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 deterioration can be prevented.

The following script reads a CSV file and appends the data one by one with loop operation. Though the purpose of the processing is equal to the script consisting of only Read CSV File and Write CSV File, the performance will deteriorate.
Loop processing that deteriorates the performance

As shown in the following script, the performance deterioration can be prevented by enclosing the entire loop operation with transaction.
Loop processing that prevents the performance deterioration

Sample

The following is an example of using Loop by Number of Data to execute Read and 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 Loop by Number of Data are as follows.


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



    The contents of the CSV file written through Write CSV File operation are as follows.

    id value
    S001 10000
    S002 20000
    S003 30000