Custom Wire Checklist Report

Forum Forums SIX Reporting Custom Wire Checklist Report

This topic contains 6 replies, has 3 voices, and was last updated by  Kevin Frye 3 years ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #6699

    Kevin Frye

    I’m working on a custom wire checklist report.
    We have prewire items (placeholder item) that contain bulk wire as accessories.
    I want to show the prewire item as the top level item with a checkbox.
    Then indented, I want to show the accessory wires without a checkbox.

    I’ve been looking at using the ItemID and ParentID fields to sort but I cannot locate the code snippet that shows how to sort on fields inside of the script. I had a report several years ago with this.

    I also considered a modified proposal style report because it has close to what I need with dynamic grouping.
    I just need to figure out how to ignore Packages when they exist.

    A link to a snippet of code where the XML data is grabbed and sorted inside of the script would be great.
    I know one used to exist on the old forum but it no longer loads.


    Seth Enos

    RE: Case 28651

    Hi Kevin,

    I know you are working with Eduardo on this via the case referenced above. We are looking into a solution for this.



    Kevin Frye

    I know for a fact that the script I am looking for was posted to the old forum more than once. Versions of the same script were provided to me by either naresh or nkarthick…

    It has been a few years though.


    Nicole Devlin

    I second this topic – it would be really nice to run a report this way! I’ve been trying to figure it out for a while but with no success.


    Seth Enos

    Attached is a custom Wire Checklist report that was built using subreports for the level 2 and level 3 items, i.e. it respects Accessories and Packages and keeps them together in the report, similar to how our Proposal reports work. You can modify this report to indent the Accessories if you wish.

    I am not familiar with what script you are referring to, but I did find an old forum post discussing script to sort subreport. I hope this is what you were looking for.



    Kevin Frye

    Thanks Seth. I’ll take a look at this. It sounds about right.
    Support just sent me the script. It is listed below and attached.
    FYI for those who may tru to use this: fire the resort script from the ActiveReport_DataInitialize event in your report.
    The DataInitialize event only fires once so that means your sort only fires once.
    At first I thought it made sense to call the sort inside of FetchData but that fires on every record in your report.

    ” *******************************************************************
    ” *******************************************************************

    ‘ Resort Items will take up to five levels of sorting
    ‘ to zone at only one level, simply pass a value to the first parameter and empty strings to the rest (see example)
    ‘ See list of valid strings that may be passed to the 5 parameters below

    ‘ To sort items by Zone, then manufacturer, then model, then Itemhash, the call would be:
    ‘ ResortItems(“Zone”, “Manufacturer”, “Model”, “ItemHash”, “”)

    ‘ This routine can be modified to take more sort fields and to control the direction (Ascending or Descending)…etc.

    Sub ResortItems(ByVal FirstSortField As String, ByVal SecondSortField As String, ByVal ThirdSortField As String, ByVal ForthSortField As String, ByVal FifthSortField As String)

    Dim ds As GrapeCity.ActiveReports.Data.XMLDatasource = Ctype(rpt.DataSource, GrapeCity.ActiveReports.Data.XMLDatasource)

    ‘ create a criteria object and add a sort order
    Dim rc As New DTools.SystemIntegrator.Reporting.ReportCriteria()

    Dim sort As DTools.SystemIntegrator.Reporting.SortOrder = Nothing

    sort = ReturnSortOrder(FirstSortField)
    If sort IsNot Nothing Then
    End If

    sort = ReturnSortOrder(SecondSortField)
    If sort IsNot Nothing Then
    End If

    sort = ReturnSortOrder(ThirdSortField)
    If sort IsNot Nothing Then
    End If

    sort = ReturnSortOrder(ForthSortField)
    If sort IsNot Nothing Then
    End If

    sort = ReturnSortOrder(FifthSortField)
    If sort IsNot Nothing Then
    End If

    If rc.ReportSortings.Count = 0 Then Return

    ‘ create a reportdatahelper and pass in the criteria object
    Dim rdh As New DTools.SystemIntegrator.Reporting.ReportDataHelper(rc)

    ‘ return a namespacemanger with all the required namespaces
    Dim nsMgr As System.Xml.XmlNamespaceManager = DTools.SystemIntegrator.Reporting.ReportingNamespaceUtility.ReturnXMLNamespaceManager(ds.Document.NameTable)

    ‘ get a nodelist of all the items
    Dim NodeList As System.Xml.XmlNodeList = ds.Document.SelectNodes(“//dtr:Items/dtr:Item”, nsMgr)

    ‘ iterate over the item nodes and add each item to the reportdatahelper
    For Each xNode As System.Xml.XmlNode In NodeList

    ‘ get the project, Items, and proposalItems nodes in the DS XML
    Dim projNode As System.Xml.XmlNode = ds.Document.SelectSingleNode(“//dtr:Project”, nsMgr)
    Dim ItemsNode As System.Xml.XmlNode = projNode.SelectSingleNode(“//dtr:Items”, nsMgr)
    Dim PropItemsNode As System.Xml.XmlNode = projNode.SelectSingleNode(“//dtr:ProposalItems”, nsMgr)

    ‘ create temp elements to hold the newly sorted items
    Dim newItems As System.Xml.XmlElement = ds.Document.CreateElement(“I”)
    Dim newPropItems As System.Xml.XmlElement = ds.Document.CreateElement(“P”)

    ‘ create the namespace declarations to be injected into the XML strings returned from the RDH
    Dim s As String = String.Empty

    Dim nsEnum As System.Collections.IEnumerator = nsMgr.GetEnumerator()
    Do While nsEnum.MoveNext
    If nsEnum.Current.ToString <> “” AndAlso nsEnum.Current.ToString <> “xmlns” Then
    s = String.Concat(s, String.Format(” xmlns:{0}=””{1}”””, nsEnum.Current, nsMgr.LookupNamespace(nsEnum.Current.ToString)))
    End If

    ‘ insert the namespaces in the XML strings and update the innerXML of the temp elements
    newItems.InnerXml = rdh.ReturnItems.Insert(10, s)
    newPropItems.InnerXml = rdh.ReturnProposalItems.Insert(18, s)

    ‘ replace the original nodes in the DS with the newly sorted XML elements
    projNode.ReplaceChild(newItems.FirstChild, ItemsNode)
    projNode.ReplaceChild(newPropItems.FirstChild, PropItemsNode)

    ‘ force the datasource to reload the document

    End Sub

    ‘ return a ‘SortOrder’ object for the re-order
    Function ReturnSortOrder(ByVal propertyName As String) As DTools.SystemIntegrator.Reporting.SortOrder

    If propertyName Is Nothing Then Return Nothing
    propertyName = propertyName.Trim
    If propertyName = String.Empty Then Return Nothing

    ‘ Valid Values for the second parameter of this constructor are:

    ‘ DTools.SystemIntegrator.Reporting.SortDirection.Ascending
    ‘ DTools.SystemIntegrator.Reporting.SortDirection.Descending

    ‘ This method could be modified to control the direction, but this is beyond the scope of the example
    Return New DTools.SystemIntegrator.Reporting.SortOrder(propertyName, DTools.SystemIntegrator.Reporting.SortDirection.Ascending)
    Catch ex As System.Exception
    Return Nothing
    End Try

    End Function

    ” *******************************************************************
    ” *******************************************************************


    Kevin Frye

    And FYI, the old forum never loads when I click on links to it. I’m pretty sure I found references to what I was looking for but none of the links actually loaded…
    The old forum is a treasure trove of valid information (if it loaded).

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.