ST1
6 months agoNew Contributor III
Reading dictionary type
I am using below sql to get validation messages from the workflow transformation process to be used in Transformation Event Handler. But, I need to put the output of this dictionary into a flat file. How I can read the contents of this dictionary created.
Thanks so much for your help!
sqlValidation.Append("Select * ")
sqlValidation.Append("From StageToFinanceValidationError ")
sqlValidation.Append("Where StageToFinanceValidationError.WorkflowProfileKey = '" & wfPk.ProfileKey.ToString & "' ")
sqlValidation.Append("And StageToFinanceValidationError.WorkflowTimeKey = '" & wfPk.TimeKey.ToString & "' ")
sqlValidation.Append("And StageToFinanceValidationError.WorkflowScenarioKey = '" & wfPk.ScenarioKey.ToString & "' ")
Using dbConnApp As DBConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
dtValidation = BRAPi.Database.ExecuteSqlUsingReader(dbConnApp, sqlValidation.ToString, False)
Dim sb_ValErrorsReport As New Text.StringBuilder()
For Each drVal As DataRow In dtValidation.Rows
Dim strValMsg = drVal("ValidationmessagesXml")'.ToString()
Dim validationMsgList As DataCellValidationMsgList = XmlObject.ReadXmlString(si, GetType(DataCEllValidationMsgList), strValMsg, True)
If Not validationMsgList.Messages Is Nothing And validationMsgList.Messages.Count <> 0 Then
Dim errmessage As String = validationMsgList.Messages(0).ErrorMsg
Dim errdetails As List(Of String) = validationMsgList.Messages(0).StringParams.ToList()
errmessage = string.Format(errmessage, errdetails.ToArray())
If Not errorDict.Keys.Contains(errmessage) Then
Dim templist As New List(Of List(Of String))
templist.Add(errdetails)
errorDict.Add(errmessage, templist)
Else
errorDict(errmessage).Add(errdetails)
End If
End If
Next