Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 - Asset Console Creating an Access Definition File Guide


[CSV_FILE_LOOP] (get CSV file data)

[CSV_FILE_LOOP] specifies the beginning and end of processing to acquire data from a CSV file.

Organization of this page

Syntax

[CSV_FILE_LOOP]
  CSV-file-name
  [CSV_COLUMN_NAME]
    column-name=column-number
  [BEGIN]
    processing-on-acquired-data
  [END]
[CSV_FILE_LOOP_END]

Values

Status

The following table lists and describes the possible statuses:

Status

Description

NORMAL

NODATA

End of data.

ERROR

There is a row that contains more than 32 kilobytes of data in a single column.

MULTI

Legend:

—: Not applicable

Remarks

Processing stops if the specified CSV file does not exist.

Whether or not importing of data from the CSV file is terminated is determined according to the status referenced by the [CSV_FILE_LOOP_END] loop end tag. If the status is NORMAL, processing continues. If the status is other than NORMAL, processing terminates. This last fact is useful when an error that occurs during processing interrupts processing at the point the error occurred.

When processing continues until no data remains, before determining whether or not to end processing according to the [CSV_FILE_LOOP_END] tag, we recommend that you use the $SETSTATUS embedded function to explicitly specify NORMAL as the status.

The status of the access definition file is updated on an ongoing basis by execution of tags and embedded functions. If processing that updates the status is specified more than once in a [CSV_FILE_LOOP] tag, you must determine whether or not to terminate processing based on the status that was last specified.

Example

The following example acquires data from rows in the CSV file input.csv, and outputs the acquired data by row number:

[SET_VALUE]
  FILENAME = 'input.csv'
  CNT = 1
[CSV_FILE_LOOP]
  FILENAME
  [CSV_COLUMN_NAME]
    COLUMN1 = 1
    COLUMN2 = 2
    COLUMN3 = 3
    [SET_VALUE]
      MSG = ' LINE('+CNT+') ['+COLUMN1+']['+COLUMN2+']['+COLUMN3+']'
      $ECHO(MSG)
      CNT = $ADD(CNT,1)
 
  [SET_VALUE]
    $SETSTATUS('NORMAL')
[CSV_FILE_LOOP_END]
Execution result:

LINE(1) [0000000001][R11111][active]

LINE(2) [0000000002][R22222][restore]

LINE(3) [0000000003][R33333][scrap]