Custom Reporting Library

A Dynamic Link Library (DLL) named CrowsNest.Reporting.dll is provided which has some functions used to extend the reporting functionality in MS Report Builder.

The library is included in the installation directory where Crows Nest is installed (typically C:\Program Files (x86)\Crows Nest).

To preview reports that use the library from within Report Builder, you’ll need to copy the DLL file into the installation directory for Report Builder (typically C:\Program Files (x86)\Microsoft Report Builder)

To utilize the functions, open a report in Report Builder and follow the steps below:

Add a Reference to the library

  1. Open Report Properties

  2. Select References

  3. Under ‘Add or remove assemblies’ click Add

  4. On the newly added reference record click the button to browse to the CrowsNest.Reporting.dll file and click Open

  5. Click OK to close Report Properties

Add Code to the report

  1. Open Report Properties

  2. Select Code

  3. Add a Function using VB .NET syntax to call the function from the library
    Example:
    Function PadLeft(imgBytes, cellWidth, cellHeight, centered)
    Return CrowsNest.Reporting.Images.PadLeft(imgBytes, cellWidth, cellHeight, "in", centered)
    End Function

  4. Click OK to close Report Properties

Add Expression to call the Code

  1. Edit any Expression and Reference the Code
    Example:
    =Code.PadLeft(Fields!Logo.Value, 2.5, 1, True)

Available Functions

Combine the header below with the function name to reference the function in Code
Example: CrowsNest.Reporting.Strings.HTML_BulletedList

Strings

  • HTML_BulletedList - Process text into a bulleted list using HTML syntax. To have the HTML rendered in the report, open Placeholder Properties for the Placeholder using this code and change Markup type to ‘HTML’. If the Header parameter is supplied it will look for a header in the text provided in the Value parameter for a header surrounded by double square brackets and will return only the text between that header and the next header found or the end of the text if a subsequent header is not found.
    HTML_BulletedList(Value as String, Delimiter as String, Optional Header as String) as String
    Example:

    • Text in Value Parameter

      [[Exclusions]] Applicable sales taxes All Electrical, Plumbing, HVAC [[Notes]] This Proposal becomes part of a contract document This proposal is valid for 30 days.
    • Function reference in Code

      CrowsNest.Reporting.String.HTML_BulletedList(Fields!LongDescription.Value, Environment.NewLine, “Exclusions”)
    • Result

      <ul> <li>Applicable sales taxes</li> <li>All Electrical, Plumbing, HVAC</li> </ul>
  • JoinNonNull - Join an array of objects to a string with a delimiter, excluding any empty values.

Images

  • PadLeft - Calculate a Left Padding value to horizontally align a database image to center or right. To align right change CenterImage parameter to False.

  • PadTop - Calculate a Top Padding value to vertically align a database image to center or bottom. To align bottom change CenterImage parameter to False.

  • ColorToHex - Get a hexadecimal color string from a String or a System.Drawing.Color

    • Example Expressions

  • StringToColor - Get a System.Drawing.Color from a color string

  • QRCode - Generate a QRCode image as a byte array to display in an Image object.

    The following overload accepts a logo image in a byte array instead of a logo filepath

    See the following explanation for each of the arguments

    • content = Text content of the QRCode

    • size = Pixels per module. Large values here can cause out-of-memory errors from the report viewer.

    • logofilepath = Filepath to a logo to embed in the center of the QR Code (example: C:\\myimage.png)

    • logobytes = Byte array of logo to embed in the center of the QR Code. This can be an image field from a dataset (example: Fields!Logo.Value)

    • IsURL = True if the content is a web URL to format the QR Code as a URL Payload

    • darkcolor = Dark color in the QR Code (examples: “black”, “255,255,255”)

    • lightcolor = Light color in the QR Code (examples: “white”, “0,0,0”)

    • Example

      • Expression (Value property on an Image with Source set to Database)

      • Code

Timeline

  • TimelineHeaderImage - Returns an image for the header cell including year/month/day to mimic the header of the timeline view in Tasks.

    • Example

      • Expression

      • Code

  • TimelineRowImage - Returns an image for the data row cell to mimic the the data rows of the timeline view in Tasks. Available values for the MarkerType parameter are Diamond, Triangle, Circle and Square (not case sensitive).

     

    • Example

      • Expression

      • Code