Whatever message this page gives is out now! Go check it out!
CSVProcess(filePath,rowProcessor,rowFilter[,csvFormatConfiguration])Name | Required | Type | Description | ||||||||||||||||||||||||
filePath | Yes | String | The path of the CSV file to be read. | ||||||||||||||||||||||||
rowProcessor | Yes | UDF | Method to run for each row. This method accepts two parameters – row and row number. It needs to return CSV object. | ||||||||||||||||||||||||
rowFilter | Yes | UDF | Method to filter each row based on a condition. | ||||||||||||||||||||||||
processRowAsJavaArray | No | Boolean | Whether to process row as Java array (for better performance). Valid only for arrayof JavaArray. | ||||||||||||||||||||||||
csvFormatConfiguration | No | Struct | A struct containing the configuration of reading the streaming spreadsheet. The keys are:
|
<cfscript>
valuesProcessed = 0;
cashPayment = 0;
theFile = GetDirectoryFromPath(GetCurrentTemplatePath()) & "CSVReadFile.csv";
CSVProcess(filepath =#theFile#,rowprocessor =(row, rowNumber)=> {
valuesProcessed += ArrayLen(row)
index = arrayfind(row, "2021")
if(index neq -1) cashPayment++;
},
rowFilter = (row, rowNumber)=> {
//return true
if(rowNumber mod 2 eq 0) return true
else return false
},csvformatconfiguration={})
writeoutput('Entries processed : ' & valuesProcessed & '<br>Cash paid for ' & cashPayment & ' trips.')
</cfscript><cfscript>
valuesProcessed = 0;
cashPayment = 0;
theFile = GetDirectoryFromPath(GetCurrentTemplatePath()) & "CSVReadFile.csv";
CSVProcess(filepath =#theFile#,rowprocessor =(row, rowNumber)=> {
valuesProcessed += ArrayLen(row)
index = arrayfind(row, "2021")
if(index neq -1) cashPayment++;
},
rowFilter = (row, rowNumber)=> {
//return true
if(rowNumber mod 2 eq 0) return true
else return false
},csvformatconfiguration={"delimiter":","})
writeoutput('Entries processed : ' & valuesProcessed & '<br>Cash paid for ' & cashPayment & ' trips.')
</cfscript><cfscript>
valuesProcessed = 0;
cashPayment = 0;
theFile = GetDirectoryFromPath(GetCurrentTemplatePath()) & "CSVReadFile.csv";
CSVProcess(filepath =#theFile#,rowprocessor =(row, rowNumber)=> {
valuesProcessed += ArrayLen(row)
index = arrayfind(row, "2021")
if(index neq -1) cashPayment++;
},
rowFilter = (row, rowNumber)=> {
//return true
if(rowNumber mod 2 eq 0) return true
else return false
},csvformatconfiguration={"nullString":"2021"})
writeoutput('Entries processed : ' & valuesProcessed & '<br>Cash paid for ' & cashPayment & ' trips.')
</cfscript><cfscript>
valuesProcessed = 0;
cashPayment = 0;
theFile = GetDirectoryFromPath(GetCurrentTemplatePath()) & "CSVReadFile.csv";
CSVProcess(filepath =#theFile#,rowprocessor =(row, rowNumber)=> {
valuesProcessed += ArrayLen(row)
index = arrayfind(row, "2021")
if(index neq -1) cashPayment++;
},
rowFilter = (row, rowNumber)=> {
//return true
if(rowNumber mod 2 eq 0) return true
else return false
},csvformatconfiguration={"quoteMode":"ALL","quotecharacter":"'"})
writeoutput('Entries processed : ' & valuesProcessed & '<br>Cash paid for ' & cashPayment & ' trips.')
</cfscript>