Closed rufuspollock closed 10 years ago
Using the current scripting interface this can be achieved using the following script:
dataset.fields = _.reject(dataset.fields, function (field) {return field.id === "_noname_";});
_.find(dataset.fields, function (field) {return field.id === "Clearing Date";}).type="date";
_.each(dataset.records, function (record) {
delete record._noname_;
if (typeof record.Amount === "string") {
record.Amount = parseFloat(record.Amount.replace(/,/g, ""));
}
if (typeof record["Clearing Date"] === "string") {
record["Clearing Date"] = new Date(record["Clearing Date"]);
}
});
saveDataset(dataset);
One caveat being that the date parsing wont work cross-browser. We maybe need to make Moment available to the worker, or provide a utility function on the memory backend.
Probably has a dependence on #129
@djw what's the status here? This is the last item to close :-)
@rgrp This is blocking on the syntax changes in #126. Once they're in, you just need to create a project with the above CSV and script, using the okfn github account, and change the link in index.html.
@djw i've responded on #126.
The above code just needs to be put inside the new loadDataset call.
@djw @rgrp I wrote a Labs blog post that turned your data and code into a simple introduction to Explorer's capabilities.
FIXED.
Here's some great example data:
http://static.london.gov.uk/gla/expenditure/docs/2012-13-P12-250.csv