Skip to main content

Logic: Iterate

Zuora
  • 日本語のコンテンツは機械翻訳されており、補助的な参照を目的としています。機械翻訳の精度は保証できません。英語版が正となります。また、現時点では検索機能は日本語での検索をサポートしていません。翻訳に関するフィードバックについては、docs@zuora.comに送信してください。

Logic: Iterate

This task iterates the input data one entry at a time by default. If you set Iteration Type to Unique-Field, it iterates by unique values of data fields. 

The input data can be from:

  • a data export or query task
  • other tasks that output CSV files
  • direct file input by users

You must define a task after an iterate task with the For Each condition to handle further data processing for each item or unique field value. 

Optionally, you can define a downstream task for the On Complete or On Failure condition. 

Workflow will start the On Complete route when all instances of the iterated task are completed. The On Complete task will wait three hours at maximum for all instances of the iterated task to complete.

workflow_iterate_downstream_options.png

Task Settings

  • Object: The input data object. It can be a data object in the payload, or a file generated by an export task or uploaded by the user. 
  • Iteration Type: If the logic of the subsequent tasks is based on unique values of a data field, select Unique-Field. Otherwise, use Default (Every Item).
  • Chunking: If the subsequent task processes multiple items at a time, specify a number as the chunking size. Chunking is useful for bulk creating, updating, or deleting operations.
  • File Type: The input file type. Only CSV and fixed-width input files are supported.
    • CSV: This is the default option. If this option is selected, you can specify a header filter to help Workflow locate the header row. 
    • Fixed-width: Select this option if the input is a fixed-width text file. If this option is selected, the Iterate task will iterate the lines in the fixed-width file. You can specify the numbers of lines to skip from the beginning and from the end.

 Use the Encoding dropdown list to specify the character-encoding scheme of the input file. 

 If a single record in the fixed-width file spans multiple rows (lines), you can add rows and specify the starting and ending indexes of the characters that you want to extract.

Screen Shot 2022-06-14 at 9.54.33 AM.png

  • Number of Rows to Skip from the Beginning (Optional): You can skip a specified number of rows from the top of a CSV file. You can also skip the trailer record of the file.

    The maximum number of heading rows that can be skipped is 25.

  • Paths of Data Payload Values to Delete: You can delete data that is not needed, to reduce task payload size and improve performance. The payload path is in the format of Data.<objectName>.

Screen Shot 2022-03-23 at 5.35.54 PM.png

Examples

If the preceding task is an export task, the file containing the exported data will be available in the Object list of the iterate task. The file name is the in the format of <object_name>_<a_number>.csv.zip.

workflow_task_iterate_export.png

If the preceding task is a query task or other tasks that save data in the payload, the Object list can be like the following:

workflow_task_iterate_query.png

If you are iterating over a fixed-width file, in which each record spans multiple rows, you can add rows and specify the starting and ending indexes of characters that you want to extract. For example, the following fixed-width file contains five records, each spans four rows. There is a starting row and an ending row.

011011234567890 0910000190909140559A094101ABC COMPANY            WELLS FARGO BANK              
025200ABC COMPANY                         2222222222PPDPREMIUM   SEP 120909120001091000017000001
036260515012990123456          00000018130001234        BOB B BROWN SR          1091000010111111
04799R08091000010111111      05150129                                            091000010001234
05820000000200051501290000000018130000000000002222222222                         091000010000001
065200ABC COMPANY             (R)         2222222222PPDPREMIUM   SEP 120909120001091000019000002
076262642790914321123443       00000050000001333        Ronald Reed             1091000010222222
08799R01091000010222222      26427909                                            091000010002345
09820000000200264279090000000050000000000000002222222222                         091000010000002
105200ABC COMPANY                         1111111111PPDPREMIUM   SEP 120909120001091000017000003
116260841006385656565          00000039920001357        Sheryl S Smith          1091000010333333
12799R07091000010333333      08410063                                            091000010003456
13820000000200084100630000000039920000000000001111111111                         091000010000003
145200ABC COMPANY                         1111111111PPDPREMIUM   SEP 120909120001091000017000004
156261211330050120120120       00000000000001579        WAYNE WILSON            1091000010444444
16798C02091000010444444      12113300121140218                                   091000010004567
17820000000200121133000000000000000000000000001111111111                         091000010000004
185200ABC COMPANY                         2222222222PPDPREMIUM   SEP 120909120001091000017000005
196260653054369898989898       00000000000002345        GEORGE GONZALES         1091000010555555
20798C05091000010555555      0653054337                                          091000010005678
21820000000200065305430000000000000000000000002222222221                         091000010000005
229000005000003000000100058631944000000010805000000000000                                      

You can skip the first and the last row, then add four rows in the settings.

wf_iterate_fixed_width.png

After the workflow is run, the first record of the iteration looks like this:

wf_iterate_fixed_width_example.png