Search code examples
filemaker

Boolean for whether a number is in a range


Suppose I have a variable $$Range which is inputted as either a range (e.g. 1..2).

Can I write a boolean which is true if $$Number is in the range $$Range, and false otherwise?

E.g. $$Number is 1 and $$Range is 1..2 should return True, and $$Number is 4 and $$Range is 1..2 should return False.


Solution

  • For convenience Set Variable [$$range2; Substitute($$Range;["..";" "];["...";" "]) ]

    Then, the required boolean is:

    RightWords($$range2;1) <= $$Number & $$Number < RightWords($$range2;2)