• Puspender Tanwar
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello,
I am using the salesforce bulk api to extract data. I have some issue with the format that salesforce provide me the data using Bulk api. Below is the short code i used which ran successfully and creates a csv for me :
InputStream inputStream = bulkConnection.getQueryResultStream(job.getId(), batchInfo.getId(), resultId);
OutputStream out = new FileOutputStream(file);

try {
	int read = 0;
	byte[] bytes = new byte[1024];
		 
	while ((read = inputStream.read(bytes)) != -1) {
			out.write(bytes, 0, read);
	}
	inputStream.close();
	out.flush(); 
	logger.log(logger.DEBUG,"New file created!");
	} catch (IOException e) {
		logger.log(logger.DEBUG,"ErrorMsg in wrtting csv file"+e.getMessage());
		throw new RuntimeException("ErrorMsg in wrtting csv file"+e.getMessage());
}

All I have done is wrote the bytes provided by salesforce into a csv file, i have not changed/modified anything. Now the issue is, in this csv all the Logical records are terminated by LF(Line feed) and the physical records are terminated by CRLF(carriage return + Line feed). attached is the snapshot
csv by bulk api
Now  if I download the same objects records by using Data Loader, the downloaded csv is of different format. In this csv all logical records are terminated by CRLF and physical by LF, opposite of bulk api csv.
csv by Data Loader

All I want to known is if there is any way I can download the records in the format that Data Loader provide, by using the bulk api.
Any suggestion would  be heartily appreciated. Thanks 

I would like to know how can I insert NULL values for a record through Data Loader in below two scenarios-

Scenario1- In case of Normal API

Scenario2- In case Bulk API


Can you please illustarte it with example. It will be a great help to understand it.