DataTable to XLS losing Display Names
I have a workflow to select a parcel, buffer it, then export the results to an XLS file.
I have set 'Display Names' on all the fields in GeoCortex Manager so they are more easily readable for a human.
Everything is working well, and the display names are being used all the way to when the buffer is created (buffer results in the table view show the display names), but once the export to Excel happens, it reverts back to the field names.
The steps in the 'Export to Excel' part of my workflow are:
1. FeatureSetToDataTable (featureset name = 'Selection', DataTable name = 'dtSelection')
2. Assign (dtSelection.TableName = 'ParcelTable')
3. DataTableToXls (Datatable = 'dtSelection', Result = 'byteParcels')
4 CreateTempFile (Content = 'byteParcels', Content type = 'application/vnd.ms-excel', etc.
The next steps in the workflow just make the file available for downloading by an href.
I am presuming that either the 'FeatureSetToDataTable' or 'DataTableToXls' are causing the issue here, but I am not sure which one, and how to force it to use the display name.
Any thoughts on how I can force the display names, (or alias for that matter) to be used instead of the field names?
Cheers!
-
Just bumping this to see if anyone has some suggestions.
I have a user creating a mailing list that she has to manually change the column names because mail merge fails with column names that look like:
"MantaImage.ARCGISPROD.%Manta_Property_Owner_Mailing_Addresses_Formatted.DELIVERY_ADDR" instead of "Address"
Thanks.
0 -
Bumping again.
I would really like an answer or explanation on this issue if possible.
I have implemented a mailling list application for our Clerks department to replace a mapguide app. These oddly named field headings are causing them problems in their process to create a mail merge.
Please someone give me some direction on this.
Thanks!
0 -
Hi Bret,
This is a two parter:
- The FeatureSetToDataTable activity does not currently apply the FeatureSet FieldAlias values to the Captions of the DataColumns.
- The DataTableToXls activity does not currently apply the DataColumn Caption values to the XLS document.
We will consider both of these for inclusion in a future version of the software.
There is a work around. You need to loop through the Columns of the DataTable and overwrite their ColumnName values to match the aliases in the FeatureSet. Then when you use DataTableToXls it will have the column names you want.
--Ryan
0 -
I'm trying to do the described "loop through the Columns of the DataTable and overwrite their ColumnName values", but am stuck on how to actually implement it. Reason I need this is I have a DataTable with ridiculously long field names I want to rename before the export to Excel, but I cannot figure out how to set up a For Each <T> to do the loop. Any type I've used for the <T> gives me Implicit Conversion errrors. System.Data.DataTable and System.Data.DataTable[} are two examples of what I've tried for <T>. Perhaps I need to use something else entirely. Please help.
0 -
Works perfectly. Thanks so much, Nico!
0
Please sign in to leave a comment.
Comments
5 comments