Issue faced at workplace 1
Problem
Database returns: InternalCalls: "61;34;35"
Need: 3 separate columns with values 61, 34, 35
Solution Summary
What We Did
- Added helper methods to identify and split semicolon columns
- Modified header generation to output 3 column names instead of 1
- Modified data processing to split values on
;and output separately - Added "Teams To Teams Calls" heading when these columns appear
Where We Changed Code
- Async CSV (
GenerateCSVContentAsync): ModifiedAddCsvHeadersandProcessRowsWithFilteringAsync - Sync CSV (
GetCSV): Modified thedsGlobalKPIprocessing section - Excel (pending): Will need DataTable restructuring
Core Logic
If column is "InternalCalls" or "ExternalCalls":
Headers: Output 3 names instead of 1
Data: Split "61;34;35" → output "61,34,35"
Else:
Output normallyKey Learnings
- Same logic, different contexts - Had to implement splitting in 3 places (async CSV, sync CSV, Excel) because each uses different data structures
- Headers must match data - Expanded 1 column → 3 columns in both places to keep counts aligned
- The real fix is in the database - Application-side splitting is a workaround. Ideally, the stored procedure should return 3 separate columns
- Performance matters - For Excel with large data, DataTable restructuring is faster than cell-by-cell writing
Comments
Post a Comment