Barcodes attributes longer than 16 characters, breaks Arcade popup script that incorporates C1Factor or C2Factor

704
2
05-23-2023 06:02 AM
Labels (2)
EdJuarbe
New Contributor III

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: 

  1. Modify the arcade script to get around the 'Field not Found' error.
  2. 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.

0 Kudos
2 Replies
TomDeWitte
Esri Regular Contributor

Hi Ed,

A very interesting set of circumstances you have encountered. Your example barcode with greater than the ASTM F2897 standard format of 16 characters is a first form me.  And then the issue of the Text() function somehow fixing a "Field not Found" error is an interesting situation. The failure to successfully write to the BARCODE (Text16) field is not surprising as it is defined to a length of 16 characters. 

As you noted the first 16 characters conform to the ASTM F2897.  When I decoded it, it read that this was a 1" Plug Valve by Elster Perfection. When I added the additional characters the script failed, due to the text string exceeding the size of the BARCODE text field.

For the pop-up script, it might benefit from some additional error handling to catch this type of issue. Would you please email me at: tdewitte@esri.com so we can review your configuration and together figure out the best resolution.

Thanks

Tom DeWitte

Esri Technical Lead - Natural Gas Industry

0 Kudos
EdJuarbe
New Contributor III

Thanks Tom... I just sent you an e-mail.

0 Kudos