Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
access_csv_file [2020/05/10 03:27]
admin removed
— (current)
Line 1: Line 1:
-===== Read CSV File ===== 
- 
-CSV and text files can be accessed with MScript. Below is an example of MScript to set up dataset for the csv file and MScript to read the data from the dataset: 
- 
-  <!-- declare data set --> 
-  <dataset id="fileDS" autorewind="true" mode="replace" db="File:dataSetFile.csv"/> 
-   
-  <!-- load data from the file --> 
-  <action code="$loadFromDataSource('fileDS')"/> 
-   
-  <!-- read the data from data set --> 
-  <log level="" message="$dataSetInfo('fileDS')"/> 
-  <log msg="reading data: $getData('fileDS','col1')"/> 
-   
-  <!-- advance data set to next row --> 
-  <action code="$nextDataSetRow('fileDS')"/> 
-  <log msg="reading next row: $getData('fileDS','col1')"/> 
-