Hello Zach…
Please correct me if I am wrong here but what you are doing is basically asking if the number is less than or equal to 3… and if it is such: it is “cc-amex”…
BUT in the end of your final IF statement: you state that if it is less than or greater to 2 it is “times”… ALSO that if it is incompatible to all IF statements: it is yet again: “times”
Why this is sort of odd for me is that IF 2, 3, 4, 5, 6 is the only possible outcomes: then wouldn’t it be best to start with 6 and leave out 2 (As final falseValue shall others not have been met) or to start with 2 and leave out 6? Since 2 is ALSO lesser than or equal to three (Unless there is a coding situation I am missing out on If I type in 1 I get “cc-amex”… If I type 2 I get “cc-amex” and 3 again “cc-amex”…
This sort of renders the last IF(self.inputVal <= 2,
“times” satement falicious so such 2 (or less) will never give you “times”… Only numbers greater than 6 will.
And THAT would be possibly why you get a:
situation
Now as I get it… You have a card number (16 digits) and you wnat to take the first digit off of it to evaluate.
Whereas this number would determine the bank:
- 2 → Times
- 3 → amex
- 4 → visa
- 5 → mastercard
- 6 → discover
Am I right?
IF so… Wouldn’t you be best off to isolate the first digit before playing the IF
game?
From the top of my head I would say “Divide it by 1000000000000000” (as inconvenient as that may sound…)… FLOOR
it to round it down to the nearest integer and then plug it into the IF loops excluding the “Lesser than” sign.
Hmmm wait… In retrospect… You would I presume want “the card” available from start onward right?
So even in the first number: You would like it visible… Wait… Then best we divide it by a 10 to the power of the number of digits in the variable… Something like:
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 ))
This should give you ALWAYS the first number how many numbers ever you type into the field…
STRING
reads the text value of the input where LENGTH
counts the letters in it (Hence why we made it a string)… POWER
takes the first value and gives it the power of the second value… FLOOR
takes the lower integer of the division.
(The additional “-1” is so that you get a number greater than 1… Like when you have a three digit number it will be divided by ten to the power of 3… Making it 0,1)
**Sort of LONG but well… like this (GIVEN that your variable is a NUMBER!!) ** might actually work for you…
IF(
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 )) == 2,
"times",
IF(
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 )) == 3,
"cc-amex",
IF(
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 )) == 4,
"cc-visa",
IF(
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 )) == 5,
"cc-mastercard",
IF(
FLOOR(self.inputVal / POWER(10, LENGTH(STRING(self.inputVal)) - 1 )) == 6,
"cc-discover",
"Error"
)
)
)
)
)
LOL now that I finished the typing and copy/pasting of values… MAN does that look goofy… LONG and pretty wrong
(THOUGH it SHOULD work!!)
And only AS I finished typing I realized that theoretically I could have just converted it to a STRING
and then TRUNCATE
'ed it 
I am a certified Idiot 
I so hope this was helpful or at least entertaining 