Monday, August 24, 2009

Template Wizard does create SheetNames with more than 30 characters

The Template Wizard (Administration/Periodic/Data export/import/Excel spreadsheets/Template Wizard) creates unfortunately SheetNames that might exceed 30 characters, which is not allowed by Excel and results in annoying message boxes that are requesting a new SheetName with less than 31 characters.

The following code change in the method SysDataExcelDef/buildTmpExcelWorksheet will resolve this problem:

1: //modifications done for working with long tablenames
2: // str tempSheetName;
3: // str suffixName;
4: // int suffixlength;
5: //original code:
6: //tmpExcelWorksheet.SheetName = tmpExcelWorksheet.TableName + '_' + int2str(sysExpImpTable.OccurrenceId) + '-1';
7:
8: tempSheetName = tmpExcelWorksheet.TableName + '_' + int2str(sysExpImpTable.OccurrenceId) + '-1';
9:
10: if (strlen(tempSheetName) > 30)
11: {
12: tempSheetName = tmpExcelWorksheet.TableName;
13: suffixName = '_' + int2str(sysExpImpTable.OccurrenceId) + '-1'; //as this is done in the original code
14: suffixLength = strlen(suffixName);
15: tempSheetName = substr(tempSheetName, 0, 30 - suffixLength);
16: //assigning the new name
17: tmpExcelWorksheet.SheetName = tempSheetName + suffixName;
18: }
19: else
20: {
21: tmpExcelWorksheet.SheetName = tempSheetName;
22: }

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...