Select to view content in your preferred language

Arcade Find Function not working like I wish it would

418
1
10-02-2023 03:29 PM
Labels (2)
GISUser74305830
New Contributor III

Situation:

  • I have an AGO point layer of assets.
  • User adds new assets and edits existing assets
  • User only edits the asset category field (DTP_Cat2)
  • Arcade script auto-calcs a Counter field (DTP_Counter) to uniquely number each asset by category
  • Arcade script auto-calcs DTP_Asset_ID = DTP_Cat2 + "-" + DTP_Counter

Objective:

  • SCENARIO #1: If user adds a new feature and selects a category, DTP_Counter gets the next sequential number and calcs in DTP_Asset_ID. This is done and works fine.
  • SCENARIO #2: If user edits an existing feature but doesn't change the category, the script doesn't modify the Asset ID.
  • SCENARIO #3: If user edits an existing feature but does change the category, the script gets the next sequential number for that category and calcs in DTP_Asset_ID.

Issue:

  • Scenarios 2 and 3 are not working for me. The script just doesn't want to fire off. I seem to have pinpointed the issue to the Find function. I'm trying to use the Find function to say: if "STP-CO" is in "STP-CO-14" (it is), then don't change the ID; however, if "STP-AR" is not in "STP-CO-14" (it's not), then change the ID. I don't know what I'm doing wrong but the Find function is not working for me.

Data structure:

DTP_CounterDTP_Cat2DTP_Asset_ID
14STP-COSTP-CO-14
14STP-ARSTP-AR-14
15STP-COSTP-CO-15

 

@jcarlson 

Tags (2)
0 Kudos
1 Reply
GISUser74305830
New Contributor III

@XanderBakker  or @jcarlson  - any ideas?

0 Kudos