How can I edit the fields that are exported from the query widget to a CSV file?

1585
7
Jump to solution
01-13-2020 01:52 PM
KristinVernon
New Contributor III

I configured a filter to allow the user to filter of a layer to be able to show data based on a range of dates. However, when this data is exported it shows more fields (such as the GlobalID, created_user, created_date, etc...) in the exported report, which I have set not to show in the pop-ups. Also, I have a field which, when the user enters the data, is a drop down of different options, however when entered in the database it is an ID number.

I assume that upon exporting the CSV there is some query that called in order to export the filtered results into a CSV file, would there be anyway to edit this query or format the fields that are exported?

I am using the Web AppBuilder in my company's portal.

Also, I noticed that I can configure the Attribute Table widget to show exactly what I want, however, I've read the export function is not currently operational 😕

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Kristin,

   The problem with working in Portal is the code is obfuscated and what you searching for could be a.fields or c.fields as the featureSet var is likely changed durring obfuscation.

View solution in original post

7 Replies
RobertScheitlin__GISP
MVP Emeritus

Kristin,

   Portal 10.7.1 uses WAB 2.12 and there was a bug in 2.12.

https://community.esri.com/thread/235592-cant-export-query-result-to-csv-in-the-attributetable-widge... 

0 Kudos
KristinVernon
New Contributor III

Yes, I've read that. But I would mostly like to find out if there's a way where I can edit exactly what fields the Query widget itself exports? Possibly through the js files?

I would like to omit exporting fields such as the ID fields and so forth.

0 Kudos
KristinVernon
New Contributor III

Yes, I also saw that question but as you can see below, when searching for that line in the SingleQueryResult.js file, I'm returned with "No Results".

The file that i am searching is in the ProjectName->widgets->Query folder. Possibly I am searching the wrong file? I also cannot find the file "ExportToCSV.js"

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kristin,

   The problem with working in Portal is the code is obfuscated and what you searching for could be a.fields or c.fields as the featureSet var is likely changed durring obfuscation.

KristinVernon
New Contributor III

Ahh I see so:

featureSet.fields = lang.clone(layer.fields);

Is actually like:

d.fields = f.clone(a.fields); 

for me.

This works for one of my problem, the other problem is that I use Domains for two of my fields. Therefore while in my application it appears as follows:

When I export this to CSV it exports as:

I would like it to export the value and not the code.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kristin,

  Sorry I am not sure about the domain issue fix.