Skip to main content

Quick Report Finding Syntax Errors in Document Notes - Knowledgebase / SalesPad / Reporting - Cavallo Technical Support

Quick Report Finding Syntax Errors in Document Notes

Authors list
Overview

An error will be encountered when a sales document containing improper syntax is opened. Use the Quick Report on the following page to pull all document notes in order to find syntax errors.

Error:

Quick Report:





SELECT Notes, * FROM spv3SalesDocument

WHERE CHARINDEX('SalesPad_Notes', CAST(Notes AS VARCHAR(MAX))) > 0;

 
foreach (System.Data.DataRow dr in dataRow.Table.Rows)
{
    string allNotes = dr["Notes"].ToString();
   
    string preXml = (allNotes.IndexOf("<SalesPad_Notes>") == -1
        ? allNotes
        : allNotes.Substring(0, allNotes.IndexOf("<SalesPad_Notes>"))).TrimEnd('\r', '\n', ' ');
       
    string postXml = (allNotes.IndexOf("</SalesPad_Notes>") == -1
        ? ""
        : allNotes.Substring(allNotes.IndexOf("</SalesPad_Notes>") + ("</SalesPad_Notes>").Length)).TrimEnd('\r', '\n', ' ');
       
    string xml = allNotes.Substring(allNotes.IndexOf("<SalesPad_Notes>"));
    xml = xml.Substring(0, xml.IndexOf("</SalesPad_Notes>") + ("</SalesPad_Notes>").Length);
   
    try
    {
        System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
        xd.LoadXml(xml);
       
        // System.Windows.Forms.MessageBox.Show(dr["Sales_Doc_Num"].ToString() + "\r\n\r\n" + xml);
    }
    catch (System.Exception ex)
    {
        System.Windows.Forms.MessageBox.Show(dr["Sales_Doc_Num"].ToString() + "\r\n\r\n" + ex.Message + "\r\n\r\n" + allNotes);
    }
}



 

 

Helpful Unhelpful