Select to view content in your preferred language

Arcade Smart Form Calculation no longer working

328
0
01-13-2023 09:09 AM
Labels (1)
Caitlin_Todd_LCOR
New Contributor III

Hello, 

I have an Arcade script that was used to auto-sequence the case number for a site and reset to 1 every year. This was working in a smart form less than a year ago. But now I get an error that my arguments for my Filter function have an invalid parameter. I tried adjusting the script to put my sql filter into its own variable then refer to it in the Filter function, but then I get an error message saying "parameter isn't a function". The code that was working before is below. 

Was there an update in Arcade that affected the Filter function? 

//returns the current year
var timestam = Today()
var currentyear = Year(timestam)
 
//increment by 1 from highest number for only features within current year
var setfeatures = FeatureSetByName($map,"layer name",['CaseNumber','CaseYear'],false)
var numberlist = Filter(setfeatures, 'CaseYear=@currentyear')
var topnum = Top(OrderBy(numberlist,'CaseNumber DESC'),1)
var counter = Number(Max(topnum,'CaseNumber'))
var siteid = counter+1

return siteid

  

0 Replies