We are currently testing the Pipeline Tracking & Traceability data model and Arcade popup scripts developed by @TomDeWitte, and have stumbled on barcodes that do not conform to the ASTM F2897-15a 16 characters format.
During our testing, we came across a valve whose barcode decoded to a value that exceeded the anticipated 16-character format. Before changing the field width, the OOTB arcade scripts were a simple drap/drop in our Attribute Expression dialog. No other changes were made. Simple changing the field
Here's one example of the extracted barcode attribute: 'ELboG04njHV70Z90MW6 DEMO'.
To allow the capture of the extended characters, we attempted to create a new longer barcode field, but after doing so, the arcade scripts for the popup failed to save correctly, resulting in this error: 'Execution Error: Field not Found', which is odd since the field does exist, and prior to using a long field was not an issue. I dug in and found by removing the '[text(C1FACTOR)] ' from the second to the last line (Diameter & Wall Thickness scripts): 'var DIAM = DIAMETERDICTIONARY[text(C1FACTOR)];' the script allowed to save and the popup worked (although not sure what if what is being displayed is actually correct.
Similarly, the Diameter2 and WallThickness2 scripts has similar issue but removing the '[text(C2FACTOR)]' portion from the following line: var DIAM = DIAMETERDICTIONARY[text(C2FACTOR)]; allow the script to be saved. The C1FACTOR was not a problem if the array was removed from the script entirely.
So, I'm a little confused exactly what the C1Factor/C2Factor is actually doing, I'm faced with 2 options:
- Modify the arcade script to get around the 'Field not Found' error.
- Find a way to automatically trim the barcode to 16 characters in the Field maps app. We are currently manually removing the extra characters, which allows for the correct extraction of arcade popup values but which I feel is not going to be a reliable option. Also, I would rather retain the full barcode value since it may contain additional information that would otherwise be lost if we don't retain it at time of installation.
Would appreciate any help with this, or thought on better alternatives?
TL/DR: Discovered barcodes longer than 16 characters. Database fields wider than 16 characters cause the Diameter, Diameter2, Wall Thickness, & Wall Thickness2 arcade script to fail with 'Execution Error:Field not Found' when saving script.