onFileImport

The event occurs when an file was selected on a fileImport control. The import function will detect if the file is using a comma or a semicolon as separator. Brixxbox will therefore count the occurrences of commas and semicolons in the first line (Header) and will use the higher counted char as separator.

You can access eventArgs.details inside this event to get the file content and meta data:

  • eventArgs.details.csvLines - Array of all lines splitted by csv rules

  • eventArgs.details.lines - Array of all lines splitted by csv rules

  • eventArgs.details.fileExtension - extension of the import file ("csv" for example)

  • eventArgs.details.fileExtensionLower - extension of the import file in lowercase

  • eventArgs.details.fileInfo - a javascript file info object

  • eventArgs.details.fileName - the file name

  • eventArgs.details.fileNameLower - the file name in lowercase

  • eventArgs.details.fileNameFull - the file name with extension

  • eventArgs.details.fileNameFullLower - the file name with extension in lowercase

  • eventArgs.details.rawData - the whole file content as a single text

  • eventArgs.details.rawLines - an array of all the lines. Use this if you want to split the lines following your own rules

for(let i = 0; i < eventArgs.details.lines.length; i++){
    console.log(`This is line ${i} with name: ${eventArgs.details.lines[i].myNameField}`);
}

Last updated