Hi,
In an Arcade statment, I am losing patience on silly syntax in an 'if' statment, with condition to compare the first 3 digits of postal code with a variable stored in an array, as below:
if (Left(city.postal_code,3) == myArray[f]) {
The 'if' statment is simply ignored!
But if I hard-code a value, that's works fine:
if (Left(city.postal_code,3) == '332') {
Any guess where the problem is?
Solved! Go to Solution.
For your code to work, the value of myArray[f] must be a string. If it's a number, it won't work. You have to use this syntax if it's a number
if (Left(city.postal_code,3) == Text(myArray[f])) {
Here's a demo of that in the playground
Seems like myArray[f] is not equal to "332"...
That's all we can tell you from that snippet. If you want more detailed help, you'll have to post the whole expression.
For your code to work, the value of myArray[f] must be a string. If it's a number, it won't work. You have to use this syntax if it's a number
if (Left(city.postal_code,3) == Text(myArray[f])) {
Here's a demo of that in the playground
Fantastic! Good to know array values has to be casted to text for 'if' statments... Very useful.
You have to cast the value array to Text since "Left(city.postal_code,3)" is also a Text.