LoadCSVFile Method


9.0B, PLBCMP GUI Only

 

The LoadCSVFile method loads the contents of a CSV file into a LISTVIEW object. The method uses the following format:

 

 

[label]

{object}.LoadCSVFile

[GIVING {return}] USING [*FileName=]{fname}[:

 

 

 

[*Options=]{options}][:

 

 

 

[*Delimiter=]{delim}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A LISTVIEW object that is accessed.

return

Optional. A Numeric Variable that indicates the success or failure of the method.

fname

Required. A Character String Variable or literal that specifies the file name.

options

Optional. A decimal number or Numeric Variable that specifies the load options.

delim

Optional. A Character String Variable or literal that specifies the delimiter character.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. If the value returned is zero, the ZERO Condition Flag is set.

  2. The OVER and EOS Condition Flags are always cleared.

  3. When running under the PL/B Application Server, the first character of the file name has special meaning:

  4.  

    Value

    The file ...

    ! (exclamation mark)

    resides on the client rather than the server.

    ? (question mark)

    should be either obtained from the cache or from the server and placed in the cache.

    * (asterisk)

    should be either obtained from the in-memory cache or from the server and placed only in the in-memory cache.

     

  5. The {options} value is a constant as defined in PLBMETH.INC or a numeric variable indicating one or more of the following option values:

  6.  

    Keyword

    Value

    Meaning ...

    $LV_CSVRD_QUOTED

    0x1

    The input fields are enclosed in quotes.

    $LV_CSVRD_INPUTHEADER

    0x8

    The first record in should be loaded into the column headers.

    $LV_CSVRD_NOZEROWIDTH

    0x10

    Any column with a zero width is skipped. The corresponding field in the CSV record is not skipped.

    $LV_CSVRD_NOOEM2ANSI

    0x100

    NO OEM to ANSI translation (9.9A)

     

  7. If not specified, {delim} defaults to a comma.

  8. A return value of zero (0) indicates success. Failures return one of the following values:

  9.  

    Value

    Meaning ...

    200

    There is a file name problem.

    201

    There are no columns defined in the listview.

    202

    Unable to open the specified file.

    203

    Unable to read the specified file.

    204

    A long record was encountered.

     

  10. The colums must have been previously defined.

  11. This method supports back to back double quote characters as a means of forcing a single double quote character into the output column data string when quote option mode is being used. (9.3A)

  12. This method is not available when using the PL/B Web Server with the LINUX/Linux operating system.

 

 

See Also: Method Syntax, LISTVIEW Methods

 



PL/B Language Reference InsertItemEx Method (LISTVIEW) LoadXMLFile Method (LISTVIEW)