Custom JavaScript code creates the field doubles

I set up 2 APIs (Transactions, Licenses) from the marketplace . Next, I added a script to get a range of users.
The Script was:
function capitalize(s) {
return s && (s.charAt(0).toUpperCase() + s.slice(1).toLowerCase());
}
function getUsersRange(users) {
if (users <= 10) return [1, 10];
if (users <= 25) return [11, 25];
if (users <= 50) return [26, 50];
if (users <= 100) return [51, 100];
if (users <= 250) return [101, 250];
if (users <= 500) return [251, 500];
if (users <= 2000) return [501, 2000];
if (users <= 10000) return [2001, 10000];
return [10000, 999999];
}

doc.app = {
key: doc.addonKey,
name: doc.addonName
}
doc.hosting2 = doc.hosting;
if (doc.licenseType && doc.licenseType.indexOf(“_”) >= 0) {
doc.licenseType = .map(doc.licenseType.split("“),
function(s) {return capitalize(s)}).join(” ");
} else {
doc.licenseType = capitalize(doc.licenseType);
}
doc.licenseType2 = doc.licenseType;
doc.status = capitalize(doc.status);
doc.status2 = doc.status;

doc.date = doc.maintenanceStartDate
if (doc.licenseType == ‘Evaluation’) {
doc.evaluationLicense = 1;
} else {
doc.evaluationLicense = null;
}
if (doc.licenseType == ‘Demonstration’) {
doc.demonstrationLicense = 1;
} else {
doc.demonstrationLicense = null;
}
if (doc.licenseType == ‘Commercial’ || doc.licenseType == ‘Academic’) {
doc.paidLicense = 1;
} else {
doc.paidLicense = null;
}
if (doc.licenseType == ‘Community’ || doc.licenseType == ‘Open Source’) {
doc.freeLicense = 1;
} else {
doc.freeLicense = null;
}

if (m = doc.tier.match(/(\d+) users/i)) {
var users = +m[1];
var range = getUsersRange(users);
doc.licenseTier = {
range: “” + range[0] + “-” + range[1] + " Users",
rangeMax: range[1],
tier: doc.tier,
tierUsers: users
};
} else if (doc.tier.match(/unlimited users/i)) {
doc.licenseTier = {
range: “Unlimited Users”,
rangeMax: 999999,
tier: doc.tier,
tierUsers: 999999
};
}

if (doc.contactDetails) {
doc.region = doc.contactDetails.region;
doc.country = doc.contactDetails.country;
}
if (doc.partnerDetails) {
doc.partnerType = doc.partnerDetails.partnerType;
doc.partnerName = doc.partnerDetails.partnerName;
} else {
doc.partnerType = “(none)”;
doc.partnerName = “(none)”;
}
Question, why did this script add the field “Hosting2”, “License Type2”, “Status2”. If these fields were already in the data source (“Hosting”, “License Type”, “Status”)?

@Olesya

why do you use the line “doc.hosting2 = doc.hosting” in your Javascript?
It simply copies the value from one field to another and that generates new field for column mapping?
I believe these parts are not necessary as the original hosting field is already one of the fields by default.

Martins /eazyBI