Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, Stream, EventHandler(AFProgressEventArgs))

PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, Stream, EventHandler(AFProgressEventArgs))

  • Last UpdatedNov 18, 2025
  • 3 minute read
PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, Stream, EventHandler(AFProgressEventArgs))
Imports the comma-separated value (CSV) representation of any object from a stream.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public int ImportCsv(
	AFDatabase targetDB,
	PIImportMode importMode,
	CultureInfo culture,
	Stream csvStream,
	EventHandler<AFProgressEventArgs> handler
)
Public Function ImportCsv ( 
	targetDB As AFDatabase,
	importMode As PIImportMode,
	culture As CultureInfo,
	csvStream As Stream,
	handler As EventHandler(Of AFProgressEventArgs)
) As Integer

Dim instance As PISystem
Dim targetDB As AFDatabase
Dim importMode As PIImportMode
Dim culture As CultureInfo
Dim csvStream As Stream
Dim handler As EventHandler(Of AFProgressEventArgs)
Dim returnValue As Integer

returnValue = instance.ImportCsv(targetDB, 
	importMode, culture, csvStream, handler)
public:
int ImportCsv(
	AFDatabase^ targetDB, 
	PIImportMode importMode, 
	CultureInfo^ culture, 
	Stream^ csvStream, 
	EventHandler<AFProgressEventArgs^>^ handler
)
member ImportCsv : 
        targetDB : AFDatabase * 
        importMode : PIImportMode * 
        culture : CultureInfo * 
        csvStream : Stream * 
        handler : EventHandler<AFProgressEventArgs> -> int 

Parameters

targetDB
Type: OSIsoft.AFAFDatabase
The AFDatabase to import the CSV data into.
importMode
Type: OSIsoft.AFPIImportMode
One or more of the PIImportMode values which indicates how to import.
culture
Type: System.GlobalizationCultureInfo
The culture-specific settings to be used for conversion of times, dates, floating-point values, etc. If , the current culture will be assumed. If the invariant culture is specified, then DateTime's will be assumed to be in UTC time.
csvStream
Type: System.IOStream
The stream object containing the CSV data.
handler
Type: SystemEventHandlerAFProgressEventArgs
Event handler method that will be called after each line of the CSV data is processed. If , import will occur silently.

Return Value

Type: Int32
Returns the number of items updated or created.

Remarks

The CSV representation of the objects are imported into the specified target PI Asset Database.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in