Rules using "is between" / "is not between" and negative numbers

Forums Classic DFFS Rules using "is between" / "is not between" and negative numbers

Viewing 2 reply threads
  • Author
    Posts
    • #23967
      Eric Dickerson
      Participant

      I have a rule that is using the qualifier of “Is not between”… see image, but here is the set up for the rule:

      TempField
      Is Not Between
      {fieldA}-{FieldB}

      This works fine with a value of -1000 for fieldA and a value of 1000 for FieldB, AS LONG AS TempField is a POSITIVE number… if a negative number is entered into TempField, the rule does not understand the use of Negative numbers. So, if I entered -20 into the temp field it would make the rule true, but it should be false because -20 IS NOT between -1000 and 1000.

      I tested this with actual numbers rather than field internal name references and got the same result. (Note it may be worth mentioning in the contextual help that you can use field names in curlyBrace in the value field for this method)

      I tested with IS between and IS NOT between… same issue with both.

      Seems like a bug, maybe I am missing something.

    • #23982
      Alexander Bautz
      Keymaster

      Hi,
      You are right, there is a bug with negative numbers in general with this trigger. I’ll fix this in the next release and hopefully get it out during this week / weekend.

      You can make a workaround using a custom function like this in your Custom JS:

      function compareTemp(){
          var match = false;
          var min = Number(getFieldValue("minTemp"));
          var max = Number(getFieldValue("maxTemp"));
          var trigger = Number(getFieldValue("triggerTemp"));
          if(trigger >= min && trigger <= max){
              match = true;
          }
          if(!match){
              spjs.dffs.alert({
                  "title":"Not within number range",
                  "msg":"The number " + trigger + " is not in the correct range: " + min + " to " + max
              });
          }
      }

      Call this function from a rule triggering on change on the input field. Change minTemp, maxTemp and triggerTemp field names to match your FieldInternalNames.

      Alexander

    • #25410
      Eric Dickerson
      Participant

      Running into issues after the upgrade… I am on version 4.4.3.64… I am using the “isBetween” and “Is Not Between” trigger… rather than using values in these fields like 100:200 I am using field names like {acmin}:{acmax}… however when these rules are triggered, they throw errors saying:

      The field “acmin:acmax” was not found. Ensure you use the proper FieldInternalName.

      Previously the format for these fields was {acmin}-{acmax}… but that had a negative number bug… now the format is {acmin}:{acmax}… this seems to view this string as ONE field with an internal name of “acmin:acmax”.

      Thanks in advance!!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.