3

I am tasked with creating a multiple If/Else If statement in an Arcade Symbology Expression.

I have 16 date fields, 8 sets of a planned submittal date, and 8 sets of the actual submittal date. So I need to symbolize when something is being submitted late, OR is past today's date. However, if the last/final submittal field is on time or early, it shouldn't be marked late anymore.

I have tried a few variations, but this is the closest I have come to getting a correct output:

function switch(value){
    if (value){
        return false;
    } else {
        return true;
    }
}

if (switch(isEmpty($feature.ActualApproveSummary))) {
    if ($feature.ActualApproveSummary > $feature.PlannedApproveSummary) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualReviewPartialSummary))) {
    if ($feature.ActualReviewPartialSummary > $feature.PlannedReviewPartialSummary) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualTransmittalLetter))) {
    if ($feature.ActualTransmittalLetter > $feature.PlannedTransmittalLetter) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualePMUpload))) {
    if ($feature.ActualePMUpload > $feature.PlannedePMUpload) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualConfirmCorrections))) {
    if ($feature.ActualConfirmCorrections > $feature.PlannedConfirmCorrections) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualCorrections))) {
    if ($feature.ActualCorrections > $feature.PlannedCorrections) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualReviewOwnershipDocsMaps))) {
    if ($feature.ActualReviewOwnershipDocsMaps > $feature.PlannedReviewOwnershipDocsMaps) {
        return "Late"
    } else {
        return "On Time"
    }
} else if (switch(isEmpty($feature.ActualOwnershipDocsMaps))) {
    if ($feature.ActualOwnershipDocsMaps > NOW ){
        return "Late"
    } else {
        return "On Time"
    }
} else { return "Didn't Work"} 

The code starts at the end/last date fields, and works backwards. The code does correctly symbolize parcels that end on time, but it does not work on the last date field in the expression.

I have tried IIF and When expresions, but also didn't get it to work just right.

  • I don't seem to be able to edit your question (at least not on mobile), but could you please introduce code block formatting, putting each condition on it's own row? – Stefan Jun 29 '18 at 20:22
  • I'm not sure why, but I tried to when posting originally, and it won't let me. – Lindsy Hales Bentley Jun 29 '18 at 20:25
  • By "last date field in the expression" do you mean $feature.ActualOwnershipDocsMaps? – Stefan Jun 30 '18 at 8:06
  • 1
    Also, check out the ! (Logical not) operator. It will make the switch() custom function obsolete and improve readability of your code. – Stefan Jun 30 '18 at 8:07
  • Oh, and is NOW a typo? The function should be Now(). – Stefan Jun 30 '18 at 8:24

Your Answer

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

Browse other questions tagged or ask your own question.