Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Current »

 

Description

Variables and attributes of type blob representing valid CSV files can be parsed to collections of object instances. Please see 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

 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.