This commit is contained in:
2022-03-29 19:56:25 +00:00
parent 7624d0a19a
commit a88b086df2
2 changed files with 3 additions and 108 deletions

View File

@@ -66,7 +66,7 @@ import chartBarHorizontalControl from "./components/chart-bar-horizontal-control
//DEVELOPMENT MODE
//THIS SHOULD BE FALSE IN RELEASE
//************************************************************
const DEV_MODE = true;
const DEV_MODE = false;
//************************************************************
//**************************************************************
//**************************************************************

View File

@@ -144,30 +144,15 @@ export default {
}
//transform the input csv if it's not a direct match to json (part assembly etc)
transform(dat, this.ayaType);
//console.log("Done parseCSVFile");
} else {
dat = await parseJSONFile(this.uploadFile);
//console.log("Done parse json");
}
// console.log(
// "The processed data before cleaning is ",
// JSON.stringify(dat)
// );
//strip out any unsupported fields before transmission
cleanData(dat, this.ayaType);
// console.log(
// "The processed data AFTER cleaning is ",
// JSON.stringify(dat)
// );
// eslint-disable-next-line no-debugger
//debugger;
//console.log("Flattened:", Flatten(dat));
// console.log(
// "if it was csv it should look like this:\n",
// "CSV FORMAT:\n",
// Papa.unparse(dat)
// );
@@ -284,7 +269,7 @@ async function parseCSVFile(file) {
Papa.parse(file, {
header: true,
skipEmptyLines: true,
// dynamicTyping: true,
// dynamicTyping: true,
worker: true,
complete,
error
@@ -326,7 +311,6 @@ function transform(dat, atype) {
});
break;
}
//console.log("transform after:", dat);
}
//////////////////////////////////////////////////////////
@@ -633,93 +617,4 @@ function cleanData(dat, atype) {
}
});
}
/* HOW TO GET PROPERTY NAMES EASILY
Get the object from network traffic:
Assign it in code to a variable:
var v = {
Name: "XYZ Accounting",
Active: true,
Notes: "Ergonomic impactful info-mediaries",
Wiki: null,
CustomFields: null,
Tags: ["black", "zone2", "zone3"],
WebAddress: "https://example.biz",
AlertNotes: null,
BillHeadOffice: true,
HeadOfficeId: 1,
HeadOfficeViz: "XYZ Head Office",
TechNotes: null,
AccountNumber: "10402542",
ContractId: null,
ContractViz: null,
ContractExpires: null,
LastWorkOrderViz: 350,
LastServiceDateViz: "2022-03-09T00:00:00Z",
Phone1: "373-707-7322 x535",
Phone2: "281.718.4551",
Phone3: "1-452-791-5760 x84358",
Phone4: null,
Phone5: null,
EmailAddress: "Annabel.Hahn64@example.org",
PostAddress: null,
PostCity: null,
PostRegion: null,
PostCountry: null,
PostCode: null,
Address: "9723 Tiara Summit",
City: "Hansenside",
Region: "Mississippi",
Country: "Japan",
Latitude: -7.7692,
Longitude: 165.0654
};
In a javascript console use this Object.getOwnPropertyNames(<PASTE OBJECT HERE>); will output a nice array with field names
[
"Name",
"Active",
"Notes",
"Wiki",
"CustomFields",
"Tags",
"WebAddress",
"AlertNotes",
"BillHeadOffice",
"HeadOfficeId",
"HeadOfficeViz",
"TechNotes",
"AccountNumber",
"ContractId",
"ContractViz",
"ContractExpires",
"LastWorkOrderViz",
"LastServiceDateViz",
"Phone1",
"Phone2",
"Phone3",
"Phone4",
"Phone5",
"EmailAddress",
"PostAddress",
"PostCity",
"PostRegion",
"PostCountry",
"PostCode",
"Address",
"City",
"Region",
"Country",
"Latitude",
"Longitude"
]
if it was csv it should look like this:
Name,Active,Notes,Wiki,CustomFields,Tags,WebAddress,AlertNotes,BillHeadOffice,HeadOfficeViz,TechNotes,AccountNumber,ContractViz,ContractExpires,Phone1,Phone2,Phone3,Phone4,Phone5,EmailAddress,PostAddress,PostCity,PostRegion,PostCountry,PostCode,Address,City,Region,Country,Latitude,Longitude
"ACopyOf Altenwerth, Willms and Krajcik",true,Advanced web-enabled productivity,,,"black,white",https://example.info,,true,"Gerlach, Howe and Crist",,40810165,,,(868) 464-5253,1-788-655-8853 x08455,536.824.7646,,,Maximo_Ziemann10@example.net,00060 Davion Mission,East Kevonstad,Washington,Iraq,68361-2305,75163 Heller Plains,East Kevonstad,Washington,Iraq,33.3014,-157.7912
"ACopyOf Adams, Macejkovic and Stoltenberg",true,Multi-layered multi-tasking infrastructure,,,zone9,https://example.biz,,false,,,21491466,,,830-720-4993 x86044,1-306-960-6200 x0811,1-269-482-1221 x97391,,,Leanne99@example.com,4399 Hegmann Pass,South Velva,Georgia,Chile,44636-1335,6036 Reggie Pine,South Velva,Georgia,Chile,41.1883,-152.6866
*/
</script>