12 Replies Latest reply on Oct 16, 2017 11:21 AM by rjaiswal RSS
    rjaiswal Explorer

    Getting blank rows of record when I am using ReadCSVFiles service of CSVParserFuntions for reading data from CSV files

    Hi,

     

    Please find attachments,

     

    I am using ReadCSVFiles service of CSVParserFuntions for reading data from CSV files. CSV file contains 3 row of records actually (You can see in attached EmpDEtails.csv file).

     

    but when I execute this service I didn't get any record as output but I got 3 empty rows. I don't understand why It's happening.

     

    Please check script code below and let me know what I am missing so that I can fix it and get csv data and load it into grid.

     

    Script Code:

    var params = {   
        path: 'EmpDetails.csv' /* STRING */,
    columnMappings: 'FirstName,LastName,DOB' /* STRING */,
        hasHeader: true /* BOOLEAN */,
    //longitudeField: undefined /* NUMBER */,
    //dateFormat: undefined /* STRING */,*
    fileRepository: 'EDURepository' /* THINGNAME */,
    //latitudeField: undefined /* NUMBER */,
    fieldDelimiter: ',' /* STRING */,
    //stringDelimiter: '¨' /* STRING */,
    dataShape: 'EmpDetailsDataShape' /* DATASHAPENAME */
    };
    // result: INFOTABLE
    var result = Resources["CSVParserFunctions"].ReadCSVFile(params);
    logger.warn('result:'+result);

    var tableLength = result.rows.length;
    logger.warn('tableLength: '+tableLength);
    for (var x = 0; x < tableLength; x++) {
    var row = result.rows[x];
        logger.warn('row: '+row);
    logger.warn('FirstName: '+row.FirstName+'  LastName: '+row.LastName+'  DOB: '+row.DOB);
    }

     

     

    Please do the needful asap.

     

     

    From,

     

    Rohit Kumar Jaiswal