I'm trying to use ArcGIS online symbology expression with the if else statement. Code I’m using is:

    var dif1=$feature.Object
    var dif2=$feature.Unit
    var dif3=$feature.Object_1
    var dif4=$feature.Unit_1
    var var1
    if ( dif1 == dif2 and dif3 == dif4){
        var1 = "test";
    return var1

Is there a way to use 2 statements in 1 if line like I’m trying?

Error I get is “Parse Error:Line 9: Unexpected identifier”


Have a look at the help file about operators in the Arcade language.

I believe your code needs to be this:

var dif1=$feature.Object;
var dif2=$feature.Unit;
var dif3=$feature.Object_1;
var dif4=$feature.Unit_1;
var var1;
if ( dif1 == dif2 && dif3 == dif4){
    var1 = "test";
return var1;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.