Calculation bug in browser form but not in Infopath form - InfoPath Dev
in

InfoPath Dev

Calculation bug in browser form but not in Infopath form

Last post 05-29-2008 06:18 AM by Clay Fox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-28-2008 03:56 PM

    • saiyan
    • Not Ranked
    • Joined on 04-25-2008
    • Posts 2

    Calculation bug in browser form but not in Infopath form

    Hi all.

    I have ran into a calculation problem that only happens if the form is displayed in a browser.
    If the form is displayed by Infopath 2007 client, everything is okay.

    Below is a simplied version of the form I am working on.

    The form contains the following main data source:
    -myFields (root)
       -expenses (group)
          grandTotalCost (decimal)
          -expense (repeating group)
             category (string)
             totalCategoryCost (decimal)
             -advertising (group)
                totalCost (decimal)
                -advertisingDetail (repeating group)
                     lineDescription (string)
                     lineItemCost (decimal)
             -supplies (group)
                totalCost (decimal)
                -suppliesDetail (repeating group)
                     lineDescription (string)
                     lineItemCost (decimal)
    
    Now suppose my form contains only one repeating table which binds to "expense" repeating section.
    Each insertable line of the repeating table contains one textbox which binds to "category" and a second textbox which binds to "totalCategoryCost".
    And at the bottom of the repeating table, I have added a footer line containg another textbox which binds to "grandTotalCost".

    "grandTotalCost" is a vertical summation and has the following formula: sum(totalCategoryCost)

    If you run this form and enter two lines in the repeating table as shown below, the value of "grandTotalCost" is correctly calculated.
    Category          Total Category Cost
    -------------------------------------
    Test 1                          $1.00
    Test 2                          $2.00
    -------------------------------------
    Grand Total                     $3.00
    
    So far so good.
    This form also calculates "grandTotalcost" correctly when dispalyed as a browser form.

    The next thing I do is to add a repeating section control which binds to "expense".
    Within this repeating section control, I add another repeating table which binds to "advertising".
    Each insertable line of this new repeating table has two textboxes binding to "lineDescription" and "lineCost" of "advertising" respectively.

    Without going into detail of what I am planning to do with the extra repeating section and repeating table, let's take a look at how the first repeating table calculates its grand totals.

    If you do a quick preview or force Sharepoint library to display the form via Infopath, you will see that vertical summation of the first repeating table still calculates correctly.
    However, if the form is displayed in a browser the value of the vertical summation is now doubled as shown below:
    Category          Total Category Cost
    -------------------------------------
    Test 1                          $1.00
    Test 2                          $2.00
    -------------------------------------
    Grand Total                     $6.00
    
    If I repeat the above step and add antoher repeating section control and repeating table for "supplies", the vertical summation will be tripled as shown below:
    Line Description       Line Item Cost
    -------------------------------------
    Test 1                          $1.00
    Test 2                          $2.00
    -------------------------------------
    Total Category Cost             $9.00
    
    In other words, for each additional repeating section and repeating table controls I add, the vertical summation calcuated in the first repeating table will increase by the correct amount.

    Once again. This this problem only occurs when the form is display in a browser.
    When the form is displayed by Infopath 2007, there is no calculation errors.

    So is this problem a bug in Office Form Server 2007?

    (I think the browser form relies on JavaScript to do calculation so perhaps Office Form Server did not create JavaScript with proper functionality when the form was activated).

    Or am I doing something wrong with repeating groups and repeating section/table controls?

    (May be I should not have repeating groups (e.g. "advertising", "supplies") inside another repeating group (e.g. "expense")?

    FYI, here is the spec of our server hosting SharePoint and Form service:
    Windows 2003 Standard Edition SP2
    Windows SharePoint 3.0 service w/ SP1
    Office Form Server 2007 w/ SP1
    (We only have Office Form Server 2007 installed and not MOSS 2007).

    It would be greatly appreciated if anyone can provide some advice on what I can do.

    Thanks.
  • 05-29-2008 06:18 AM In reply to

    Re: Calculation bug in browser form but not in Infopath form

    This is interesting.

    To your reference to jscript, IPFS does not use any script and only managed code. so that might be a clue but still interesting it itterates through the repeating nodes differently.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.