Hello,
This post is a continuation of an already solved posting. The earlier post was expertly solved with the tag team combination of Justin Reynolds and Ken Buja. Although this question is correlated to another posting, I asked the question after the initial one was already solved. It just didn't seem right to carry on with the original post and not give everyone a fresh look at the new inquiry. On with the question...
The attached code below is working off of a barcode scan event within ArcGIS Field Maps. The barcode number is the following 1NF314421199 and I am attempting to use "Mid" to strip away the "1NF" leaving the rest of the barcode intact. Upon scanning, this number would be recognized in the dictionary and my corresponding Address field (form question) populated with 69944 SUNNYFIELD RD. Unfortunately, after the scan, the original barcode still comes up instead of the desired truncated version of 314421199 I am attempting to obtain from Mid.
Ken Buja graciously ran it through the Arcade Playground and it worked as expected. However, for some reason, unknown to me, it will not behave when using the field app.
Thank you all for any assistance offered!
Jeff
var lookupValue = Trim($feature.OldMeterNumber);
var meter = Mid(lookupValue, 3, 9);
var d = Dictionary(
"314421199", "69944 SUNNYFIELD RD");
if (hasKey(d, meter)) {
console(" >>> " + meter + " was found! " + "Address: " + d[meter]);
return d[meter];
} else {
console(" >>> The meter was NOT found!");
return "Unknown";
};
Solved! Go to Solution.
Johannes you did it!
I took your suggestion and created a new field entitled MeterTruncate with a display field name of Meter Number and applied the "three line code" to that field. I then re-applied the code you indicated in the first part of your reply to the address section. Everything works perfectly!
Thank you so much.
You have yourself a great day!
Jeff