Hello,
I'm trying to create mailing labels for selected parcels. I'd like to take values from the CSV that WAB can generate (in the Attribute Table widget), get a string from the result, parse it and add the results to a pdf generator. I found the CSVUtils.js, in particular the exports._createCSVStr function, but I'm having trouble implementing it. Has anyone else used this function? Please let me know how you got the parameters (datas, columns) to use in the function. Any help is much appreciated. Thank you for your time.
William
William,
What part are you struggling with? The function take a datas object with is an array of objects with key and value (i.e. field1: "blah blah") and columns which is a array of strings that represent the column names.
Hi Robert,
I'm not sure how to create the arrays with the data I want to include.
William
William,
I am struggling to see what you are struggling with. The datas object with is an array of objects with key and value (i.e. field1: "blah blah").
I guess I can provide a more detailed example:
var data = [
{
First: "William",
Last: "Miller",
Gender: "Male"
}, {
First: "Robert",
Last: "Scheitlin",
Gender: "Male"
}
];
Hi Robert,
Sorry for being so vague. Say I use the By Shape tab of your Enhanced Search widget and create a circle that encompasses multiple properties. In the Results tab, I click the ellipses button and View in Attribute Table. How would I access the data that is now displayed in the table?
William
William,
The table would just be displaying the attributes of the graphics associated with the search results. So you would get a reference to the search layer and loop through its graphics and get the attributes property of each graphic and add it to an array and that now becomes your datas array.
Hi Robert,
How do I get a reference to the search layer?
William
this.map.getLayer("some layer id");
Hi Robert,
What would the "some layer id" be for the search layer?
William
William,
It would be what you see in the attribute tables widgets tab title.