The postings on this site are my own and do not represent my Employer's positions, advice or strategies.

LifeAsBob - Blog

 

Home

No Ads ever, except search!
Saturday, December 21, 2024 Login
Public

Blog posts for the month of February,2012.
King Kutter Disc2/21/2012 8:36:54 AM

Picked up the King Kutter Professional Angle Frame Disc yesterday.

6 1/2, 20 Blades 16" Diam, with 3 adjustments, Notched discs on front, smooth discs on back, category 1, quick Hitch compatible, 540lbs !

 

 

Parse XML in a Report2/16/2012 2:27:15 PM

Parsing an XML Node in a SQL Server Reporting services report.

Nothing more fun than having to parse XML in a report. 

It is basically the following steps:

- modify the query in the dataset to include the XML column

- In the Report Properties (from the report menu pad)

   * Add a Reference to System.XML

   * Paste the code from the attached txt file in Code section (this code is specific to the XML that I was parsing, but the concept could be modified or enhanced as needed based on your requirements)

- Add a column to the report for what you are getting from the XML (notes in my case) and set the textbox Expression to =Code.ParseXML(Fields!{column here no brackets}.Value)

Below is the code to paste into the code section

Function ParseXML (ByVal xmlText as String) AS String
Dim i as Integer
Dim ret as String
Dim xmlDoc As New System.Xml.XmlDocument
Dim nodeList As System.Xml.XmlNodeList
Dim node As System.Xml.XmlNode

Try
xmlDoc.LoadXml(xmlText)
nodeList = xmlDoc.GetElementsByTagName("fd")

' Loop through the nodelist returned by the "fd" query (should be only 1)
For Each node In nodeList
' Loop through all the child nodes of "fd" and format the key-value
  For i = 0 to node.ChildNodes.Count - 1
      ret = ret & node.ChildNodes.Item(i).InnerText & vbCrLf
  Next
Next

'If the DB is Null this sets the value to "N/A" instead of #Error
Catch ex As Exception
  ret = "N/A"
  Return ret
End Try

'Format as date and time if it's an ETA
Try
Dim dt as DateTime
  dt = DateTime.parse(ret)
  ret = "ETA: " & Format(dt, "General Date")
Catch ex As Exception
End Try

Return ret

End Function


While working on this I found a new XML Editor, I have no idea if it works, but I like it, "the interface is plain and convenient"!

 

Pleasant Hill BobCat again !2/6/2012 8:25:54 AM

Other than that, the usual pictures of deer, rabbits, coyotes, squirrels, possums and racoons...


Blog Home