function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arup SarkarArup Sarkar 

Objects returned by resultInfo

Hi:

 

I would appreciate if someone can shed some information on the objects accessible from the resultInfo.get() method. For example, resultInfo.get("Id") return the Id of the record, I would like to know what else is returned. If you look in the code below you will see I am trying to get("Name") but I am not getting anything. Any documentation pointer would be helpful too.

 

 

	private void checkResults(BulkConnection connection, JobInfo job,
			List<BatchInfo> batchInfoList) throws AsyncApiException,
			IOException {
		// batchInfoList was populated when batches were created and submitted
		for (BatchInfo b : batchInfoList) {
			CSVReader rdr = new CSVReader(connection.getBatchResultStream(
					job.getId(), b.getId()));
			List<String> resultHeader = rdr.nextRecord();
			int resultCols = resultHeader.size();

			List<String> row;
			while ((row = rdr.nextRecord()) != null) {
				Map<String, String> resultInfo = new HashMap<String, String>();
				for (int i = 0; i < resultCols; i++) {
					resultInfo.put(resultHeader.get(i), row.get(i));
				}
				boolean success = Boolean.valueOf(resultInfo.get("Success"));
				boolean created = Boolean.valueOf(resultInfo.get("Created"));
				String id = resultInfo.get("Id");
				String error = resultInfo.get("Error");
				
				//GenerateCSVFile(String sFileName, String Id, String Name, String log)
				GenerateCSVFile(sFileName, id, resultInfo.get("Name"), error);
				
				if (success && created) {
					System.out.println("Created row with id " + id);
				} else if (!success) {
					System.out.println("Failed with error: " + error);
				}
			}
		}
	}

 

dkadordkador

Each row in a CSV response has three fields "Id", "Success", and "Error".  There is no name.  In any case, resultInfo is a map that you're building yourself.  You can see what columns exist in the CSV by printing out the value of your resultHeader list.