Rule error - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Rule error

Last post 06-21-2018 09:31 AM by runngun17. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 06-20-2018 06:18 PM

    Rule error

    I am not a great story teller, but I think me telling a story will let you guys understand where my error is coming from.  I am somewhat of a novice at InfoPath.

     

     I have two fields.  Both of these fields are pulling from a support list on SharePoint.  When an item is picked from a drop down to identify the unit, another field looks at a column associated with that info and provides the number of beds on that unit.

     

    I have a few other fields:

    Gains - number of patients admitted to that unit

    Losses -  number of patients discharged from that unit

    Previously Reported - Number of patients on the previous day

    Remaining - (Previously reported + gains)  - Losses

    Operating Beds - The bed count that is given from the ward

    Unoccupied Beds - Operating Beds - Remaining

    Overcapacity Beds - if patients admitted to a unit exceeds the operating bed count, this would give a positive number of how many beds over. 

     

    I have some rules and formulas for these fields:

    Unoccupied Beds has a rule that says if Number of Unoccupied beds < 0; set that field to 0 so it doesn't show a negative number.

    There is a unoccupied bed rule to get the negative number that uses the same formula: Operating Beds - Remaining

    Overcapacity beds has a rule of Unoccupied Bed rule < 0, translate that number to a positive number.  There is a function on the field property that uses the same formula.  There is another rule that says if that field was >= 0 then set the Overcapacity field to 0.

     

    I am getting this error An error occurred in the form's rules or code. The number of rule actions or the number of calls to the OnAfterChange event for a single update in the data exceeded the maximum limit.

    The rules or code may be causing an infinite loop. To prevent this, ensure that the rule action or event handler does not update the data which causes the same rule action or event handler to execute.

    Then it tells me that some rules were not applied. Operation Aborted.  

     

     

     

     

    Filed under:
  • 06-21-2018 07:58 AM In reply to

    Any chance I can see a copy of your form? You can attach it under the Options tab in a reply. In general, when I'm trying to debug something like this, I disable one rule and test, then disable another and so on. Does the unoccupied beds field use a default? Or are there rules on overcapacity and remaining that set it? If you use rules on overcapacity and remaining, you could use conditions to only set unoccupied beds when that won't be a negative number - this may also help with your current rule loop issue.
    Hilary Stoupa

  • 06-21-2018 08:21 AM In reply to

     Yes I tried to disable one of the rules and it would not give the math function for that field. 

  • 06-21-2018 08:31 AM In reply to

    Looks like you have OvercapcityBeds with a default, and then you also have rules on that field, setting that same field. I would definitely do something different there. Get rid of the default and the rules on that field, just put rules on UnoccupiedRule with conditions to set it correctly. Your first rule on UnoccupiedRule could be to set OvercapcityBeds to 0 (or blank, whatever makes sense) and then you can have rules w/ conditions to set it as desired. See if that helps w/ the looping issue.
    Hilary Stoupa

  • 06-21-2018 09:02 AM In reply to

     That worked like a charm.  Thank you.  I removed all rules and default values on the OverCapacity field and added it to the UnoccupiedRule.  One last item.  I have two fields that are not on the form named GainsNumberCount and LossedNumberCount in the folder of group3 and group5.  That has a default value of 1.  There is a sum count in the default Value of Total Gains(GainsForTheDay) and Total Losses (LossesForTheDay).  When I open the form, because I have a repeating field where patients will be added and there is a field that is already available to enter, how would you get the gains to equal 0 until an entry is added in the repeating table field.

  • 06-21-2018 09:21 AM In reply to

    Let's see - is there a value in those repeating tables that is generally filled out? Like Patient Name? You could add a filter to the sum formula so that only rows where that field is filled out count. Try this for the gains total: sum(../my:group3/my:group4/my:GainsNumberCount[../my:GainsPatienName != ""]) and this for the losses total: sum(../my:group5/my:group6/my:LossesNumberCount[../my:LossesPatientName != ""])
    Hilary Stoupa

  • 06-21-2018 09:31 AM In reply to

     Worked like a charm again. Thank you for all your help.

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