Forum Discussion

ST1's avatar
ST1
New Contributor III
4 months ago

Validation Intersection Error

I am using a below code to display Intersection Error. The code works perfectly fine- except for one thing.

The problem is when the error is - Invalid Member Name.Entity,2010
It only outputs- "Invalid Member Name" (may be because it gets period)
Is there a way to update below code to also show Entity ,2010-  instead of just 'Invalid Member Namr'
*****************************************************************
Guid gWFid = si.WorkflowClusterPk.ProfileKey;
                    int idScenario = si.WorkflowClusterPk.ScenarioKey;
                    int idTime = si.WorkflowClusterPk.TimeKey;
 
                    using (DbConnInfoApp dbConnApp = BRApi.Database.CreateApplicationDbConnInfo(si))
                    {
                        string strSQL = "SELECT * FROM StageToFinanceValidationError WHERE WorkflowProfileKey=@wfk AND WorkflowScenarioKey=@wsk AND WorkflowTimeKey=@wtk";
                        List<DbParamInfo> lstParamInfo = new List<DbParamInfo>
                        {
                            new DbParamInfo("wfk", gWFid),
                            new DbParamInfo("wsk", idScenario),
                            new DbParamInfo("wtk", idTime)
                        };
 
                        using (DataTable dtValErr = BRApi.Database.ExecuteSql(dbConnApp, strSQL, lstParamInfo, false))
                        {
                            StringBuilder sb_ValErrorsReport = new StringBuilder();
                            foreach (DataRow drVal in dtValErr.Rows)
                            {
                                string strValMsg = drVal["ValidationmessagesXml"].ToString();
                                DataCellValidationMsgList validationMsgList = (DataCellValidationMsgList)XmlObject.ReadXmlString(si, typeof(DataCellValidationMsgList), strValMsg, true);
                                
                                foreach (DataCellValidationMsg err in validationMsgList.Messages)
                                {
                                    sb_ValErrorsReport.AppendLine(string.Format(err.ErrorMsg, err.StringParams));
                                }
                            }
******************************************************************************************

 

  • Do you know what the XMLString is? How do you know that it is of type DataCellValidationMsgList? I believe from your above SQL that it is a string, so when you cast it, is it losing some of the components? Why not directly read from the XMLObject itself?