AnsweredAssumed Answered

Parse error: unexpected identifier

Question asked by DiggesCRC on Jul 24, 2017
Latest reply on Jul 25, 2017 by kenbuja

Hi all, 


I'm currently trying to write an expression to help code the color of pins for certan adresses with the rules as:

  • If the largest transaction is $1,000+, yellow pin.
  • If the first gift is within the past 18 months (let’s say past 540 days),  blue pin.
  • If the latest transaction amount is greater than 24 months (let’s say 730 days),red pin.
  • All remaining  a white pin.


I wrote two seperate codes to work and each has some errors.  I'm used to Python, but read through Arcade's documentation and couldn't find any help.  My first attempt used multiple if functions, and the second used a when function.  

The first:

if (($feature.Largest_Transaction_Amount) > 999 )

    return ("Yellow")

var datef = Date ($feature.First_Transaction_Date)

var datec = Date ()

if DateDiff (datec, datee,"days") < (541)

    return ("Blue")

var datel = Date ($feature.Latest_Transaction_Date)

if DateDiff (datec, datel, "days") > (729)

    return ("Red")


    return ("White")


and the second:

var datef = Date ($feature.First_Transaction_Date)

var datec = Date ()

var datel = Date ($feature.Latest_Transaction_Date)

When (($feature.Largest_Transaction_Amount) > 999, "Yellow",DateDiff (datec, datee,"days") < (541), "Blue",DateDiff (datec, datel, "days") > (719), "Red", 1=1, "White")


I understand there could  be some kinks with the dating, but that is not the main issue.  Any advice for the syntax or any other way to resolve either issue would be appreciated


(As a note, I prefer the second attempt, it could just be the novelty of a the function combining if and elif into a single function, but in the end I just need something that works)


Many thanks