Select to view content in your preferred language

Query widget - spatial filter and operational layer issue

9039
23
Jump to solution
02-06-2015 08:58 AM
VenusScott
Frequent Contributor

Using my local install of WAB I've configured the Query widget to select by Use spatial filter to limit the features, Only features touching a user defined area, and Add the result as operational layer.

I also want the user to be able to export the operational layer as a CSV. I haven't been able to get the operational layer to display nor do I have the option to export anything as CSV?

I do have the Attribute Table configured to Allow exporting to CSV.

Anyone else have this issue?

23 Replies
HelenWhiteley
Occasional Contributor

I have this issue consistently.  I didn't even know there was supposed to be an option to view and export results in the attribute table from query (which is exactly what I am trying to achieve) until I read this post.  Does anyone have a work around?  Or any other suggestions as to how to enable users to select information from a layer either by attribute or boundary and export it to, ideally, a Word document.

Thanks.

0 Kudos
VenusScott
Frequent Contributor

Yes there is a work around. In the "layers list" widget

Click on the "XXX_Query Result" layer, then the arrow on the right side of the layer and select Open Attribute Table.

From there you can access the selected records and export them

Hope this helps!

JoshWhite
Honored Contributor

I'm not sure this is the right place to post this but I will try anyways.  I have also created a query widget and I want to export the table to csv.  I, unlike the issues listed above, have values in the attribute table without issue but the trouble I am having is the export appears to be more of a txt or html file instead of a csv.  When I save it by adding .csv my computer recognizes this as a csv file and it opens in Excel but it just completely ignore the comma separated values and just puts it in the spreadsheet the same as it would in Notepad.  I attempted to save as a txt instead and import it into Excel and set it up as comma delimited but it still doesn't come out quite right.  Using the attribute widget (or something similar) in the same manner in my Flex Viewer and the table comes out perfectly.  I am using WAB 1.1 still as I have seen the threads that some of the widgets are not working properly in 1.2. I attached outputs from both the Flex Viewer and the WAB so you can see what I mean, the records of course not exactly the same in the two tables but that isn't really the point.  Any ideas for what the issue might be?

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Josh (or maybe Robert Scheitlin, GISP​ )  I would recommend this be moved to Web AppBuilder Custom Widgets​ as a new question, instead of as a comment (Josh, you mentioned you weren't sure where to post).

0 Kudos
JoshWhite
Honored Contributor

That's fine but I don't think this has anything directly to do with Robert's widget, I think it is more an issue with the attribute widget.

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

The Custom ​Widget group is for any WAB custom widgets, comments, questions etc., it's just that Robert is the Master if the subject.  Since it sounds like you are working on one yourself, and have questions, that would be the place to post, to get answers and for the benefit if others (To learn from your experiences), just like this thread. But especially once the original post is answered, it's better to start fresh with a new question, otherwise your question will get buried. 

I think if you look at this thread, outside of the geonet Inbox  and go to your comment you can fork it to a new question.  I was trying to find the help doc on how to do this, but couldnt find it (and I haven't done it myself).

JoshWhite
Honored Contributor

I seem to remember doing something like "forking" part of a discussion to another thread but I think I must have been the original poster of the thread because I don't see the same feature in this thread.  Also, the original query widget I was using may have been a custom widget, I cant remember, but the Attribute widget is out of the box that I am using.

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
ZeZhengLi
Esri Contributor

Josh,

The issue you mentioned can be reproduce in ie browser.

If you use chrome it works fine.

I will submit an issue to our repository, and try to fix it in next release.

JoshWhite
Honored Contributor

Thanks ZeZheng Li.  I will try that and appreciate your submission of this as an issue.

Josh White, AICP
Principal Planner

City of Arkansas City
0 Kudos
ZeZhengLi
Esri Contributor

Josh,

If you use xt version please use the following code to replace the `download` function in `Attribute\Widget.js`.

download: function(filename, text) {
        if (has('ie') && has('ie') < 10) {
          // has module unable identify ie11 and Edge
          var oWin = window.top.open("about:blank", "_blank");
          oWin.document.write(text);
          oWin.document.close();
          oWin.document.execCommand('SaveAs', true, filename);
          oWin.close();
        }else if (has("ie") === 10 || this._isIE11() || this._isEdge()) {
          var BOM = "\uFEFF";
          var csvData = new Blob([BOM + text], { type: 'text/csv' });
          navigator.msSaveBlob(csvData, filename);
        } else {
          var link = html.create("a", {
            href: this._getDownloadUrl(text),
            target: '_blank',
            download: filename
          }, this.domNode);
          if (has('safari')) {
            // # First create an event
            var click_ev = document.createEvent("MouseEvents");
            // # initialize the event
            click_ev.initEvent("click", true /* bubble */ , true /* cancelable */ );
            // # trigger the evevnt/
            link.dispatchEvent(click_ev);
          } else {
            link.click();
          }


          html.destroy(link);
        }
      },

Maybe this code can solve your issue in ie10,ie11,Edge browser.

If there still have something please let me know.

Thanks