Getting error message 'A column named 'Name' already belongs to this DataTable' when trying to 'Save As' a Report
search cancel

Getting error message 'A column named 'Name' already belongs to this DataTable' when trying to 'Save As' a Report

book

Article ID: 155341

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

Customer has ONLY one report that has shown this issue.

When the customer tries to 'Save As' his report, he doesn't get the option to select where to save the report.

Looking on the actual XML for the report, specifically under the SQL query:


Select vComputer.Name, Inv_AddRemoveProgram.DisplayName,
Inv_AddRemoveProgram.DisplayVersion, Inv_AddRemoveProgram.Publisher
from vComputer
Inner Join Inv_AddRemoveProgram on Inv_AddRemoveProgram._ResourceGuid =
vComputer.Guid
Where Inv_AddRemoveProgram.DisplayName Not Like '%update for%'
and Inv_AddRemoveProgram.DisplayName
Not Like '%hotfix for%' and Inv_AddRemoveProgram.DisplayName
Not Like '%security update%' And vComputer.Name
Like '%COMPUTERNAME%'

When we try to save the report as spreadsheet and we are waiting for the window to display where to save it, the following error appears in the NS logs:

Priority: 1
Process: w3wp
Thread ID: 67
Module: w3wp.exe
Source: global.asax
Description: Unhandled exception.  Type=System.Data.DuplicateNameException
Msg=A column named 'Name' already belongs to this DataTable.
StackTrace=
   at System.Data.DataColumnCollection.RegisterColumnName(String name,
DataColumn column, DataTable table)
   at System.Data.DataColumn.set_ColumnName(String value)
   at Altiris.Reporting.Web.ReportSave.LocalizeColumns(DataTable oDataTable,
ILocalizationProvider localizationProvider)
   at Altiris.Reporting.Web.ReportSave.ConvertData2CSV(DataTable oDataTable)
   at Altiris.Reporting.Web.ReportSave.Page_Load(Object sender, EventArgs e)
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Environment

Symantec Management Platform 7.1 SP1
ITMS  7.1 SP1

Cause

Under investigation at this time,  but so far it comes down to the column headers of the report.  If the report has two columns with the same header (in this case "Name") it will not export to a csv.   Now the odd thing here is that you will notice that it doesn't query two name columns, but "Name" and "DisplayName"; however the string localizer appears to be make both these columns show up in the UI results as just "Name" for the column header.

Resolution

This issue has been reported to the Symantec Development team. This issue should not be present with our ITMS 7.6 Release and later.

Workaround:
We added some aliases for  vComputer.Name and Inv_AddRemoveProgram.DisplayName and it solved the issue. Now we are able to see the window requesting where to save the file.

This is the modified query:

Select vComputer.Name as 'Computer', Inv_AddRemoveProgram.DisplayName
as 'Software', Inv_AddRemoveProgram.DisplayVersion,
Inv_AddRemoveProgram.Publisher
from vComputer
Inner Join Inv_AddRemoveProgram on Inv_AddRemoveProgram._ResourceGuid =
vComputer.Guid
Where Inv_AddRemoveProgram.DisplayName
Not Like '%update for%' and Inv_AddRemoveProgram.DisplayName
Not Like '%hotfix for%' and Inv_AddRemoveProgram.DisplayName
Not Like '%security update%' And vComputer.Name
Like '%COMPUTERNAME%'