Wednesday, December 8, 2010

How to trouble shoot MATH statements in CSBRs

If at all possible avoid using {MATH,statement MT} in CSBRs if at all possible. It is a performance issue that I will get into in another post shortly.

When one of your MATH statements bombs out you can typically see it in either sysinternals' Debug View or in the System Message Monitor on the navigator bar (It appears that SDE 10 no longer puts this link on the navbar by default). The thing is it just gives you the error message not the actual statement that was run against the database.

Make a backup of any edited files before editing.
  1. Open C:\Program Files (x86)\BMC\Service Desk Express\Application Server\csbr_xml_generator2.aspx in a text editor. The location might be slightly different for you depending on where you installed SDE and if your running a 32 bit versus a 64 bit OS.
  2. Do a find for string sSQL = "";
  3. We need to move the definition of this variable higher up in the page so that it will be available in the error handling portion of the page.
  4. Go ahead and comment out line by putting // in front of it.You may want to put a comment above it to tell why it was commented out. You code should look something like the following.
    //David Sullivan Commented out the next line as we are moving outside the TRY block.
    //string sSQL = "";
  5. Now search upwards for the following text.
    System.Data.IDataReader oDR = null; //#52224
    try
    {
  6. We need to put the definition of out sSQL there. So put a new line before the word try and edit it to look like the following.
    System.Data.IDataReader oDR = null; //#52224
    //David Sullivan moved the definition of sSQL outside the try block so that it can be used inside the catch block.
    string sSQL = "";
    try
    {
  7. Now we need to actually append the sSQL to our error output so that we can see it better in Debug.
  8. Search back downwards and find the following.
    GenerateErrorMessage(ruleName, "Math", ex.Message + " " + sSQL, string.Empty, string.Empty);
  9. Go ahead and edit that section to read like the following.
    //David Sullivan We need to add the sSQL to the the error message.
    //GenerateErrorMessage(ruleName, "Math", ex.Message, string.Empty, string.Empty);
    GenerateErrorMessage(ruleName, "Math", ex.Message + " " + sSQL, string.Empty, string.Empty);
  10. Now just save your changes and from now on the errors will have the actual SQL statement appended after the error message.

Wednesday, December 1, 2010

Add a Favorites ICON to SDE

    SDE ships with a favorites icon but it not actually referenced any where in the code. This is a very easy "HACK"  err fix that should take about 5 minutes with any text editor.

For the Staff interface here are the steps. (Don't forget to make a backup of the file.)
  1. Open windows explorer (ctrl+e) and navigate to the directory that SDE is installed to. 
    • The default location for 32 bit OS is C:\Program Files\BMC\Service Desk Express\Application Server
    • The default location fro 64 but OS is C:\Program Files (x86)\BMC\Service Desk Express\Application Server
  2. Find the file default.aspx and open it with your favorite text\code editor.
  3. Scroll all the way to the bottom of the page and find <body onload="CheckVersion()".
  4. Right above that you should see </HEAD> we need to put out code before that head tag.
  5. Insert a new line right before that </HEAD> and paste the following text.
    • <link rel="Shortcut Icon" href="fav.ico" />
  6. Save your changes and now staff will get a nice little favorite icon added to their links to SDE.

For the Client interface here are the steps. (Don't forget to make a backup of the file.)

  1. Open windows explorer (ctrl+e) and navigate to the directory that SDE is installed to. 
    • The default location for 32 bit OS is C:\Program Files\BMC\Service Desk Express\Self Service Desk
    • The default location fro 64 but OS is C:\Program Files (x86)\BMC\Service Desk Express\Self Service Desk
  2. Find the file default.asp and open it with your favorite text\code editor.
  3. Scroll all the way to the bottom of the page and find <BODY bgcolor="#f1f1f1" style="margin:0;.
  4. Right above that you should see </HEAD> we need to put out code before that head tag.
  5. Insert a new line right before that </HEAD> and paste the following text.
    • <link rel="Shortcut Icon" href="fav.ico" />
  6. Save your changes and now staff will get a nice little favorite icon added to their links to SDE.