Select to view content in your preferred language

Extracting CSV Data Without Saving a File

2647
13
11-23-2016 12:58 PM
WilliamMiller4
Deactivated User

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

0 Kudos
13 Replies
WilliamMiller4
Deactivated User

Hi Robert,

This is what I've been able to cobble together, but it doesn't like GraphicsLayer. I think I want the GraphicsLayer, but I looked at the  API for it and don't know what to use.

        var myLayer = this.map.getLayer("Search Results: Mailing Labels");
        array.forEach(myLayer.GraphicsLayer, function(layerItem){
               // forEach code here
        });‍‍‍‍

Any suggestions are greatly appreciated. Thank you.

William

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

William,

  If you are trying to loop through the layer Graphics then use graphics not GraphicsLayer

0 Kudos
WilliamMiller4
Deactivated User

Hi Robert,

When I try graphics (below), I get "Uncaught TypeError: Cannot read property 'graphics' of undefined."

var myLayer = this.map.getLayer("Search Results: Mailing Labels");
array.forEach(myLayer.graphics, function(layerItem){
   // forEach code here
});

William

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

William,

   Then that should tell you that your myLayer var is null then. When coding you can use console.info(myLayer); to check if your var is what you are expecting.

0 Kudos