Hi, I want to read data from a BAI file stored at ...
# suitescript
t
Hi, I want to read data from a BAI file stored at the file cabinet. I am using suite script 1.0 to read the file. data in bai file is in below format.. 02,rubrikin,121000358,1,200228,2359,,2/ 03,1416213218,USD/ 88,010,0,,Z/ I am using below code of line to read the file. var f = nlapiLoadFile('tanuja/Prior month AR Account 3218 (2).bai'); //nlapiLogExecution('DEBUG', 'Content', f.getValue()); nlapiLogExecution('DEBUG', 'Event', 'Type: ' + type + ' File: ' + f.getId()); var csvLines = f.getValue().split('/\n|\n\r/'); log.debug('CSV Length : ', csvLines); The data i m a getting using suitescript is coming as MDEsQkFOS09GQU1FUklDQSxydWJyaWtpbiwyMDAzMzAsMTMzOS....... Can anybody plz help on this to read the file lines.
b
use File.isText to determine if the file is text. It has been base 64 encoded if it is not
t
file extension is BAI
.bai file
n
if you have the full output in your log and it's not truncated you could drop it in base64encode.org and see if it decodes correctly to the data you expected. If so you will need to unencode it yourself. (don;t think in ss1.0 there is a function for that)