/
Standard CSV Processing

Standard CSV Processing

 

Description

A variables or attributes of type blob representing a valid CSV file can be parsed to a collection of object instances by simply using the fromCsv built-in function. Please read through this page for clarity on what defines a "valid" CSV file.

 

 

Example

The code snippets below demonstrates how the fromCsv built-in function can be used populate a collection of Nurse object instances:

Related model objects
persistent object Clinic {
    string name;
}
 
persistent object Nurse {
	string first_name;
	string last_name;
 
	@ManyToOne
	Clinic clinic;
}
 
object UploadedFile {
    blob data;
}
Unit function using fromCsv
 
 Nurse[] extractNurses(UploadedFile f) {
    return Nurse:fromCsv(f.data);
}
Example CSV file
 first_name,last_name,clinic.name
Beatrice,Malherbe,Sonop Clinic
Pieter,Potgieter,Somerset Clinic

 

 

 

Additional Mentions and References

 

Related content

Batch CSV Processing
Batch CSV Processing
More like this
Data Types
More like this
Quick Reference
Read with this
Lesson 09: CSV Upload and Parsing
Lesson 09: CSV Upload and Parsing
More like this
CSV Processing
More like this
Lesson 29: CSV Batch Processing and Exception Handling
Lesson 29: CSV Batch Processing and Exception Handling
More like this