Repeating tables - InfoPath Dev
in

InfoPath Dev

Repeating tables

Last post 09-20-2012 10:18 AM by Shining Star. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-20-2012 07:03 AM

    Repeating tables

    I have on repeating table in my form.. It has two textboxes in that.

    My Scenario is : I have to do calculation for second text box. If the sum of textbox1 is below 6000(this number is constant) textbox2 value will be 0 otherwise sumof textbox1 exceeds 6000 then textbox1 value will be copied to textbox2. But I dont know how to implement below scenario..

    Texbox1            Textbox2

    33                       0          Less than 6000 So 0 in textbox2

    678                     0          Less than 6000 So 0 in textbox2

    5678                   389      It should have the value of 6000 - sum(Textbox1)

    767                    767       From now on Textbox1 and Textbox2 should be similar..

    878                    878

     These are rows in Repeating table.. User can insert how many they want..

     Can any one of you please help me....

     

    Filed under:
  • 09-20-2012 09:42 AM In reply to

    Hello,

    Please try giving Textbox2 the following default value formula:

    (sum(../my:Textbox1| ../preceding-sibling::my:RepeatingGroup/my:Textbox1) - 6000 - sum(../preceding-sibling::my:RepeatingGroup/my:Textbox2)) * (sum(../my:Textbox1| ../preceding-sibling::my:RepeatingGroup/my:Textbox1) >= 6000)

     Alternatively, you could add a hidden field called RunningTotal whose default value is sum(../my:Textbox1| ../preceding-sibling::my:RepeatingGroup/my:Textbox1), and that would simplify the above formula to:

    (../my:RunningTotal - 6000 - sum(../preceding-sibling::my:RepeatingGroup/my:Textbox2)) * (../my:RunningTotal >= 6000)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-20-2012 10:18 AM In reply to

    Working like a Charm! You are Awesome! Thanks a lot Jimmy...
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.