浏览代码

Fixed duplicate code exception in DF dashboard

Kenric Nugteren 2 年之前
父节点
当前提交
d4c2003f4c
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      prs.desktop/Dashboards/DigitalFormsDashboard.xaml.cs

+ 8 - 1
prs.desktop/Dashboards/DigitalFormsDashboard.xaml.cs

@@ -947,7 +947,14 @@ namespace PRSDesktop
                 {
                     var code = variable.Code.Replace("/", " ");
                     QuestionCodes[code] = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(code.ToLower());
-                    data.Columns.Add(code, typeof(string));
+                    try
+                    {
+                        data.Columns.Add(code, typeof(string));
+                    }
+                    catch(DuplicateNameException e)
+                    {
+                        MessageBox.Show($"Error: duplicate variable code {code}");
+                    }
                 }
             }
             else if (questions.Any())