2 Replies Latest reply on Aug 30, 2016 11:55 PM by evance

    Problem with conflict checker script, extend loop exit condition to allow for multiple values

    evance

      Dear FM-Community,

       

      I am facing an issue with our starter solution (SeedCode Complete / DayBack) and am trying desperately to grasp what I a missing here... There is a conflict checker script in place that first checks if two calendar events overlap in time and – if so – then checks for any resource conflicts with those.

       

      Our resources are "rooms" and two types of "staff" and right now the conflict checker works fine when just checking for a single resource at a given time but we need to incorporate a validation for multiple resource overlaps...

       

      I am hoping to explain my issue as best as possible given that you are merely given a glimpse of the whole script-environment but I am pretty sure that my problem is of a general nature and I am eager to learn.

       

      Essentially we perform the date check in step 1 (multiple calendar resources are taken into account) and then in step 2 narrow down / loop through the results trying to compare the resource-fields and exit upon finding an issue.

       

      Find attached a screenshot of the script step(s).

       

      What I have tried so far...

       

      • I went ahead and switched the field that is checked against from "room" to "staff" just to see if there might be an issue with my variables but it works nicely -- overlapping staff-values are being identified and throw a notice like intended.
      • I duplicated the loop and had one loop for each resource, tried executing the constrain request after each of them and only once after both loops went through, both crashed...
      • Tried altering the "exit loop if"-step so it would go from
        $sc_ResouceValue = ElementeAnzahl ( $sc_TestForResource )
        
        to
        ( $sc_ResouceValue = ElementeAnzahl ( $sc_TestForResource ) ) OR ( $sc_StaffValue = ElementeAnzahl ( $sc_TestForStaff ) )
        

      None of the above worked and I am clueless as to why.

       

      That being said I would very much appreciate if you could hint me regarding where to look or which direction to take on this.

       

      Kind regards,

      Henning