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

  1. Added helper methods to identify and split semicolon columns
  2. Modified header generation to output 3 column names instead of 1
  3. Modified data processing to split values on ; and output separately
  4. Added "Teams To Teams Calls" heading when these columns appear

Where We Changed Code

  • Async CSV (GenerateCSVContentAsync): Modified AddCsvHeaders and ProcessRowsWithFilteringAsync
  • Sync CSV (GetCSV): Modified the dsGlobalKPI processing 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 normally

Key Learnings

  1. Same logic, different contexts - Had to implement splitting in 3 places (async CSV, sync CSV, Excel) because each uses different data structures
  2. Headers must match data - Expanded 1 column → 3 columns in both places to keep counts aligned
  3. The real fix is in the database - Application-side splitting is a workaround. Ideally, the stored procedure should return 3 separate columns
  4. Performance matters - For Excel with large data, DataTable restructuring is faster than cell-by-cell writing

Comments

Popular posts from this blog

Group deletion

Chart.JS does works if parent is hidden(), and CPU issue

Powershell Azure UserGroups Removal