Aggregated Sums - InfoPath Dev
in

InfoPath Dev

Aggregated Sums

Last post 08-07-2011 11:35 PM by Yesurbius. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-28-2011 06:47 AM

    Aggregated Sums

    Hi.

    I just starting to play around with merging outside of Sharepoint.   I have a regular offline form that records sales counts each day.  Each form is saved as an XML file.  Once a month, I'd like to do a merge of all that month's XML files, and report the totals for each position.

    From what I've been able to tell - I would need to create a "Monthly Rollup" view, which hard codes each product, and then uses the SUM() function, in conjunction with a hard-coded filter, filtering for each product.

    That would normally be fine - except new products are added seemingly daily and older ones are dropped off.    When I merge the form, I notice that it doesn't roll them up - it just mashes them all together.   So if I have three forms that have Apples listed, the merged form would simply have Apples listed three times as opposed to being listed once with a SUM() performed.

    In the Merge Settings (Properties of my repeating Product Group), I see an option: Combine groups with the same field value.. but when that is enabled the merge doesn't happen.  I checked the sales count field to see if there is a merge option to specify an aggregate - but it gives me "The merge action cannot be changed because no additional merge actions are available for the data type of this field." (its a Whole Number field).

     I am using Infopath 2007.  I also cannot access any custom coding functions - disabled by the IT department :P

     

     

     

     

     

     

     

  • 07-28-2011 09:11 AM In reply to

    Okay my head is hurting.  Been reading up on XSL / XSLT.   I saved my Infopath file as source files, then I went in and looked at the XSL for my "Monthly Rollup" view.   I noticed that it had:

    <xsl:for-each select="../my:Item/my:Name">

    for the group, and for the counts it had:

    <xsl:value-of select="sum(xdMath:Nz(my:SoldCount))"/>

    From what I read on XSL/XSLT groupings - that's right on the money..  that's what it should say in order to sum the SoldCount field, based on unique product Name values.

    Doesn't seem to be merging when I enable those options however.

     

    I recreated a simpler project from scratch just to see if it was something else causing the issue - and I'm getting the same results.

     My Data Source looks like this:

    Sales
      SampleDate (Date)
      Item (Group, Repeating)
        Name (Text)
        SoldCount (Whole Number)
        SaleValue (Double Number)

    On the Item Group, I went Properties -> Rules and Merge -> Merge Settings and selected Insert the groups from the source forms into the target form (default) and checked off the option Combine groups with the same field value, setting the field to my:Name

    Despite re-creating it - I am still getting the same behaviour - it doesn't seem to merge any data in (or maybe it does, but it does not put it anywhere).

     

     

  • 08-02-2011 03:09 PM In reply to

    Okay - an Update.

     

    I've still been unable to find a solution through the User Interface.
    The view XSL files that I seen, were simply describing my Expressions - not the actual transformation.
    I found this MSDN article and it sounds like it may be key.  It looks like I may have to modify / recreate the merge.xsl - thus doing a custom merge. 

    So I'm giving myself a crash course in XSLT - and going through the source files trying to figure out how infopath works with the files.

     

     

  • 08-07-2011 11:35 PM In reply to

    So here's where I'm at now.

    I've created an XSLT. I *think* its correct. I've added it as a resource and updated the manifest.xcf, telling it to use it for merges.

    I've worked through most of the errors - but am getting the following error now:



    Applying the following merge XSLT file to the data created invalid XML: ReportMerge.xsl.
    Invalid at the top level of the document.

    Line 1, Position 40
    <?xml version="1.0" encoding="UTF-16"?>
    ---------------------------------------^



    I read that I needed to add the following line in the Stylesheet section of my XSLT .. I did that - no effect.


    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>


    Will continue researching it.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.