Hello,
For starters, I've been referencing this thread to try to solve my arcade question.
I have a feature class of utilities points (hydrants, curb stops etc) with a field that references a document number where a user can fin as-built information. Those documents live in our document management system and we use the information in the "As-Builts" field (string) to populate the "As-Built Link." As an example, if the As-Built number is 930, an arcade function to calculate the link is "http://documentmanager/browse.aspx?searchParams"+ As-Built+"moreSearchParams";
Now, data entry in the past hasn't been perfect, which has resulted in a few hurdles: a) sometimes the field is empty, b) sometimes a feature appears on two as-builts, and attribute value reads something like 930,931 (which is to say, comma-separated as-built numbers), c) some features just have a string of text instead of a number, like "building plan"
I've been able to calculate a link out to the document manager which essentially excludes everything that's not one single number (because if there are multiple numbers getting calculated into the link, it will screw up the URL search). But I feel like this can be improved and automated, so I've been trying to write an attribute rule to do this when features are edited or added.
My end goal: the URL link field should be populated if there is only one as-built number, and should at least have a link calculated from the first number if there are multiple as-built numbers. If the field is empty, it would be great to have a string return, something like "no- as-built found,". Bonus for being able to calculate multiple links from the as-built number into the URL field so that each number could produce it's own document link.
To that end, following the above linked thread, I've tried to use the Split() function to pull out the first number of the split array and run the calculation. However, my rule is returning the default "not found" text regardless of whether there is a number (or two) or not.
var hasAB = !isEmpty($feature.AsBuilts);
var splitAB = Split(hasAB,",");
var countAB = Count(splitAB)
console (splitAB)
Console(countAB +" items in split array")
If (countAB > 1)
{return http://documentmanager/browse.aspx?searchParams"+splitAB [1]+"moreSearchParams";}
else
{return "No as-built found";}