Top | Previous | Next |
system.dataset.fromCSV |
Description Converts a dataset stored in a CSV formatted string to a dataset that can be immediately assignable to a dataset property in your project. Usually this is used in conjunction with system.file.readFileAsString when reading in a CSV file that was exported using system.dataset.toCSV. The CSV string must be formatted in a specific way:
"#NAMES" "Col 1","Col 2","Col 3" "#TYPES" "I","str","D" "#ROWS","6" "44","Test Row 2","1.8713151369491254" "86","Test Row 3","97.4913421614675" "0","Test Row 8","20.39722542161364" "78","Test Row 9","34.57127071614745" "20","Test Row 10","76.41114659745085" "21","Test Row 13","13.880548366871926"
Syntax system.dataset.fromCSV(csv) Parameters String csv - A string holding a CSV dataset. Returns Dataset - A new dataset. Scope All Examples In this example it is assumed that the CSV file being read was a dataset that was previously exported using system.dataset.toCSV: #Specify file path file_path = "C:\\my_dataset.csv" #Read in the file as a string data_string = system.file.readFileAsString(file_path) #Convert the string to a dataset and store in a variable data = system.dataset.fromCSV(data_string) #Assign the dataset to a table event.source.parent.getComponent('Table').data = data |