Calculate costs in a Repeating table - InfoPath Dev
in

InfoPath Dev

Calculate costs in a Repeating table

Last post 08-18-2014 11:17 AM by shanemeisner. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-11-2014 12:20 PM

    Calculate costs in a Repeating table

    After searching for a few days and not finding a solution I figured I'd try you all for some greatly appreciated help.. 

    We have a Server Request InfoPath form that has a repeating table. When users request a new server we ask them to enter the amount of Ram, Disk Space, CPU's and the OS they need.

    When they enter their values into each field we calculate the cost amount for each item( Ram, disk, cpu and OS) through data connections to the price per item stored elsewhere.

    So as an example: when the user enters the amount of Ram to the "RAM" field, we have this Rule running in the Ram field field to set the "CostRam" field:

     . * Cost[Title = "RAM" and Category = ResourceType]   this same formula is used for CPU, Disk, and OS

    Right now we have a Total field, with the formula  CostRAM + CostDisk + CostCPU + CostOS for the default value and it works fine .. until we try to add a row to the repeating table. Adding a 2nd row carries over the previous value for the total column and changes to any item ( Ram, Disk, OS, CPU) on the 2nd row changes the Total column for both rows.

    I'm trying to figure out a way to keep the first row cost total displayed and stored and then when the next row is entered, reset the Cost fields back to zero to recalculate the next added resource so that when they fill in all rows, the total cost field int he footer of the repeating table displays the overall cost for all resources requested.

     

    Thanks for your help,

    Shane

    SharePoint Business Analyst
  • 08-12-2014 10:02 PM In reply to

    Re: Calculate costs in a Repeating table

    Hi Shane,

    If you are attempting to get the values of the last row of your table, then what you would need to use is the last() function. Here is a thread which discusses issues you may encounter if you are working with web browser forms. Otherwise, I suggest using rules on the repeating fields to calculate the value onto a Total field instead of using a calculated field. Hope this helps.

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
  • 08-13-2014 06:10 AM In reply to

    Re: Calculate costs in a Repeating table

     I've attached a Word document in a zip file that will hopefully explain further the situation I am running into.

    Thanks again,

    Shane 

    SharePoint Business Analyst
  • 08-18-2014 12:25 AM In reply to

    Re: Calculate costs in a Repeating table

    Hi Shane,

    Under normal conditions, the Linecost field should not be retaining the value of the previous row. May I know if this Linecost field is located outside of the repeating table? If so then I suggest having this field placed inside the repeating table along with the CostRAM, CostDisk, CostCPU, and CostOS. This way, the Linecost field will be able to identify which specific row it is calculating. If not, kindly attach a sample of your form so I may have a clearer idea of how your form is set up.

    Regards,

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
  • 08-18-2014 11:17 AM In reply to

    Re: Calculate costs in a Repeating table

    After thinking about this over the weekend I realized where my mistake was..

    I had the calculation fields outside of the repeating table. Once I added those fields( CostRam, CostDisk, etc) to the repeating table everything worked as it should. :)

     Thanks,

    Shane Meisner 

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