Manipulating repeating tables - InfoPath Dev
in

InfoPath Dev

Manipulating repeating tables

Last post 12-02-2011 02:37 PM by Hilary Stoupa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-28-2011 12:42 PM

    Manipulating repeating tables

    Hello,

     

    Well I had a great post but then I tried to add images and all my words were deleted, so, round 2 :)

    I am working on a template part to calculate the time of one or multiple emplyees providing a single service which is billed on an 8 hour day. In essence, the cost to the customer is the same if 1 employee works 15 hours (they would be charged 8 regular and 7 at the overtime rate) or if 2 employees work the same 15 hour day by I only pay the employee regular hours. The customer would still be charged for the service (8 regular and 7 overtime hours)

    My template works, although it is a bit crude so long as forms are not merged. If the forms are merged, then all hours over 8 go into overtime (which is ok on a day to day basis but not for a summary)

     I have attached 3 documents: The template part, a screen shot of one day and a screen shot of a merged form. Any ideas?

    Ok, so it did not allow me to attach files :( Help??????

     

  • 11-30-2011 04:58 PM In reply to

    Re: Manipulating repeating tables

    You should be able to attach files under the Options tab - just one per post, so you can either zip 'em up, or add 3 posts....
    Hilary Stoupa

  • 12-01-2011 07:52 AM In reply to

    OK I've attached the files, seems Firefox wasnt up to date and Internet Explorer worked :)

    There are 2 ip files:

    Screenshots.zip includes 2 files; 1.bmp is a screenshot of a form preview where I entered time for one day. This is showing the correct calculations. The seecond, 2.bmp shows two forms which have been merged and the calculations are not showing up correctly.

    The second zip file contains the template that I created. It is one of my earlier creations so it is a little rough when it comes to data sources.

  • 12-01-2011 07:55 AM In reply to

    The screenshots zip files

  • 12-01-2011 09:36 AM In reply to

    Re: Manipulating repeating tables

    Well - the issue is with your rules, I think.

    The field /my:Liaison_Time/my:Liaison_Total_Daily_Regular_Time_For_Billing is being set based on the idea that the form will only have a single, 8 hour day. When you merge the forms, you have multiple days.

    Same with this field: /my:Liaison_Time/my:Liaison_Total_Daily_Overtime_For_Billing

    But I wonder - I guess, the expectation of merging behavior would be that these fields would just be added, right? Not that the rules would fire again....

    So I think what you are saying is that the merge behavior is not working as you'd anticipate.

    You could test this, I think. Add a condition to the rules so that you can control whether they fire (like "FieldA = true" then put a control bound to that field on your form so you can toggle it). And then try merging in a scenario where the rules won't fire - see if the fields are added instead of the rules firing....

    I guess it seems like your rule conditions may need to be the distinct number of dates * 8 to determine whether there is overtime or not - does that make sense?

    Hilary Stoupa

  • 12-01-2011 11:12 AM In reply to

    Re: Manipulating repeating tables

    I had the same thoughs so I created a repeating table with 1 column with a default value of "1" in the field. I used a Sum() of that row in the footer field and set the rules to only run when that field was <2 since when the tables merge the footer row would sum the default fields. I got some pretty strange results.... I also though of multipling by the number of days since i have the master sheet injected with the DateDiff qRule that pulls start and end dates from a different view in the complete template. This works great provided that the employees all work 8 or more hours per day. This became an issue when on the same day emplyee "A" worked 9 hours and was relived by employee "B" who only worked 6 hours. So there should be 8 hours of Regular time and 7 hours overtime. When I use the multiply by date method, it turns employee "B"'s time to 8 hours resulting in 16 hours of charges when only 15 were worked.

     I have also tried nesting the tables in repeating sections but this resulted in more strange results....

  • 12-02-2011 02:37 PM In reply to

    Re: Manipulating repeating tables

    It seems like if there were a way to use a default value, that might behave better than a rule - in the case of merging, at least.

    But the default calc would be pretty tricky, since you sort of need a condition.

    Here's a blog post that explains a way to create a type of conditional default that I've used before.

    But I think first I'd verify that the behavior was what I wanted when merging if I use default values - so set it up to use a default (like a Sum function or someting) and see if you still have unexpected behavior like you've had in your rules based version. No reason to work through the complicated logic for a conditional default if it isn't going to resolve the issue.

    Hilary Stoupa

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