This example shows how to extract the component material for given gas distribution components encoded using the ASTM F2897 standard. This specification defines requirements for the data used in the tracking and traceability base-62 encoding system and the format of the resultant code to characterize various components used in fuel gas piping systems.
In this example we are highlighting how to efficiently display the material for a natural gas component from a barcode captured in the field. In the example below we are extracting the component material from the barcode string.
Copy and paste the expression found in the expression template below to the Arcade editor in ArcGIS Online, the relevant location in ArcGIS Pro, or the relevant location in a custom app.
To configure the script to your layer, you must replace the BARCODE variables with the field containing the barcode string from the natural gas component.
var BARCODE = $feature.BARCODE;
// extract component information from barcode
var componentType = Mid(BARCODE,10,2);
var d = Dictionary(
'10', 'Other Pipe',
'11', 'Straight Pipe',
'12', 'Coiled Pipe',
'13', 'Casing Pipe',
'1A', 'Seamless Line Pipe API 5L, PSL1, Single Coat',
'1B', 'Seamless Line Pipe API 5L, PSL1, Dual Coat',
'1C', 'Seamless Line Pipe API 5L, PSL2, Single Coat',
'1D', 'Seamless Line Pipe API 5L, PSL2, Dual Coat',
'1E', 'Electric Resistance Weld Pipe API 5L, PSL1, Single Coat',
'1F', 'Electric Resistance Weld Pipe API 5L, PSL1, Dual Coat',
'1G', 'Electric Resistance Weld Pipe API 5L, PSL2, Single Coat',
'1H', 'Electric Resistance Weld Pipe API 5L, PSL2, Dual Coat',
'1J', 'Seamless and Welded Pipe ASTM A53/A53M',
'1K', 'Seamless Carbon Steel Pipe A106/A106M',
'20', 'Other Coupling',
'21', 'Socket Fusion Coupling',
'22', 'Socket Fusion Coupling with EFV',
'23', 'Electrofusion Coupling',
'24', 'Electrofusion Coupling with EFV',
'25', 'Mechanical compression coupling or nut follower',
'26', 'Mechanical compression coupling or nut follower with EFV',
'27', 'Mechanical stab coupling',
'28', 'Mechanical stab coupling with EFV',
'29', 'Mechanical interference fit coupling',
'2A', 'Mechanical interference fit coupling with EFV',
'2B', 'Welded Coupling',
'2C', 'Threaded Coupling',
'2D', 'Flanged Coupling',
'30', 'Other Adapter Coupling',
'31', 'Compression Adapter Coupling by male pipe thread',
'32', 'Compression Adapter Coupling by female pipe thread',
'33', 'Compression Adapter Coupling by butt fusion',
'34', 'Compression Adapter Coupling by butt welded',
'35', 'Compression Adapter Coupling by solvent welded',
'36', 'Stab Adapter Coupling by male pipe thread',
'37', 'Stab Adapter Coupling by female pipe thread',
'38', 'Stab Adapter Coupling by Solvent welded',
'39', 'Compression Adapter Coupling by stab',
'40', 'Other End Cap',
'41', 'Butt fusion End Cap',
'42', 'Socket fusion End Cap',
'43', 'Electrofusion End Cap',
'44', 'Mechanical compression or nut follower End Cap',
'45', 'Mechanical stab End Cap',
'46', 'Mechanical interference fit End Cap',
'47', 'Welded End Cap',
'48', 'Threaded End Cap',
'49', 'Fabricated End Cap',
'50', 'Other Elbow',
'51', 'Butt fusion 90 Elbow',
'52', 'Socket fusion 90 Elbow',
'53', 'Electrofusion 90 Elbow',
'54', 'Mechanical compression or nut follower 90 Elbow',
'55', 'Mechanical stab 90 Elbow',
'56', 'Mechanical interference fit 90 Elbow',
'57', 'Welded 90 Elbow',
'58', 'Threaded 90 Elbow',
'59', 'Fabricated 90 Elbow',
'5A', 'Butt fusion 45 Elbow',
'5B', 'Socket fusion 45 Elbow',
'5C', 'Electrofusion 45 Elbow',
'5D', 'Mechanical compression or nut follower 45 Elbow',
'5E', 'Mechanical stab 45 Elbow',
'5F', 'Mechanical interference fit 45 Elbow',
'5G', 'Welded 45 Elbow',
'5H', 'Threaded 45 Elbow',
'5J', 'Fabricated 45 Elbow',
'60', 'Other 3-Way Tee',
'61', 'Butt fusion 3-Way Tee',
'62', 'Socket fusion 3-Way Tee',
'63', 'Electrofusion 3-Way Tee',
'64', 'Mechanical compression or nut follower 3-Way Tee',
'65', 'Mechanical stab 3-Way Tee',
'66', 'Mechanical interference fit 3-Way Tee',
'67', 'Welded 3-Way Tee',
'68', 'Threaded 3-Way Tee',
'69', 'Fabricated 3-Way Tee',
'70', 'Other Reducer', '71', 'Butt fusion Reducer',
'72', 'Socket fusion Reducer',
'73', 'Electrofusion Reducer',
'74', 'Mechanical compression or nut follower Reducer',
'75', 'Mechanical stab Reducer',
'76', 'Mechanical interference fit Reducer',
'77', 'Welded Reducer',
'78', 'Threaded Reducer',
'79', 'Fabricated Reducer',
'80', 'Other Tapping Tee',
'81', 'Saddle heat fusion by butt fusion outlet tapping tee',
'82', 'Saddle heat fusion by butt fusion outlet with EFV tapping tee',
'83', 'Saddle heat fusion by socket outlet tapping tee',
'84', 'Saddle heat fusion by socket outlet with EFV tapping tee',
'85', 'Saddle heat fusion by mechanical compression outlet tapping tee',
'86', 'Saddle heat fusion by mechanical compression outlet with EFV tapping tee',
'87', 'Saddle heat fusion by stab outlet tapping tee',
'88', 'Saddle heat fusion by stab outlet with EFV tapping tee',
'89', 'Electrofusion by butt fusion outlet tapping tee',
'8A', 'Electrofusion by butt fusion outlet with EFV tapping tee',
'8B', 'Electrofusion by socket outlet tapping tee',
'8C', 'Electrofusion by socket outlet with EFV tapping tee',
'8D', 'Electrofusion by mechanical compression outlet tapping tee',
'8E', 'Electrofusion by mechanical compression outlet with EFV tapping tee',
'8F', 'Electrofusion by stab outlet tapping tee',
'8G', 'Electrofusion by stab outlet with EFV tapping tee',
'8H', 'Mechanical by butt fusion outlet tapping tee',
'8J', 'Mechanical by butt fusion outlet with EFV tapping tee',
'8K', 'Mechanical by socket outlet tapping tee',
'8L', 'Mechanical by butt fusion outlet with EFV tapping tee',
'8M', 'Mechanical by mechanical compression outlet tapping tee',
'8N', 'Mechanical by mechanical compression outlet with EFV tapping tee',
'8P', 'Mechanical by stab outlet tapping tee',
'8Q', 'Mechanical by stab outlet with EFV tapping tee',
'8R', 'Mechanical by mechanical interference fit tapping tee',
'8S', 'Mechanical by mechanical interference fit with EFV tapping tee',
'90', 'Other High Volume Tapping Tee',
'91', 'Electrofusion by butt fusion High Volume Tapping Tee',
'92', 'Saddle heat fusion by butt fusion High Volume Tapping Tee',
'93', 'Mechanical by compression outlet High Volume Tapping Tee',
'94', 'Electrofusion by socket outlet High Volume Tapping Tee',
'95', 'Saddle heat fusion by socket outlet High Volume Tapping Tee',
'96', 'Mechanical by stab outlet High Volume Tapping Tee',
'97', 'Mechanical by mechanical interference fit High Volume Tapping Tee',
'A0', 'Other Anode',
'A1', 'Cast Iron Anode',
'A2', 'Graphite Anode',
'A3', 'Magnesium Anode',
'A4', 'Zinc Anode',
'B0', 'Other Branch Saddle',
'B1', 'Electrofusion Branch Saddle',
'B2', 'Saddle heat fusion Branch Saddle',
'B3', 'Mechanical Branch Saddle',
'C0', 'Other Repair Clamp',
'C1', 'Repair Clamps',
'D0', 'Other Service Tee',
'D1', 'Welded by welded Service Tee',
'D2', 'Welded by butt fusion Service Tee',
'D3', 'Welded by Thread Service Tee',
'D4', 'Welded by compression or nut follower Service Tee',
'D5', 'Welded by mechanical interference fit Service Tee',
'DD', 'Welded by stab Service Tee',
'D6', 'Thread by welded Service Tee',
'D7', 'Thread by compression or nut follower Service Tee',
'DE', 'Thread by mechanical interference fit Service Tee',
'DF', 'Thread by stab Service Tee',
'DG', 'Thread by thread Service Tee',
'DH', 'Thread by butt fusion Service Tee',
'D8', 'Mechanical saddle by welded Service Tee',
'D9', 'Mechanical saddle by Butt fusion Service Tee',
'DA', 'Mechanical saddle by thread Service Tee',
'DB', 'Mechanical saddle by compression or nut follower Service Tee',
'DC', 'Mechanical saddle by mechanical interference fit Service Tee',
'DJ', 'Mechanical saddle by stab Service Tee',
'E0', ' Other Service Saddle',
'E1', 'Single strap Service Saddle',
'E2', 'Double strap Service Saddle',
'EF', 'Excess Flow Valve',
'F0', 'Other Filter',
'F1', 'Pilot Filter',
'F2', 'Service and Mains Filter',
'F3', 'Strainer Filter',
'M0', 'Other Meter Component',
'M1', 'Diaphragm Meter', 'M2', 'Rotary Meter',
'M3', 'Meter Set Assembly',
'M4', 'Meter bar',
'M5', 'Meter Swivel',
'M6', 'Meter nut',
'M7', 'Ultrasonic Meter',
'M8', 'Turbine Meter',
'M9', 'Remote shut off Meter',
'P0', 'Other Pressure Control Fitting',
'P1', 'Split Repair Pressure Control Fitting',
'P2', 'Bottom out Pressure Control Fitting',
'P3', 'Top tap Pressure Control Fitting',
'R0', 'Other Riser',
'R1', 'Factory Assembled Anodeless Riser',
'R2', 'Factory Assembled Anodeless Flexible Riser',
'R3', 'Factory Assembled Non-Anodeless Riser',
'R4', 'Field Assembled Anodeless Riser',
'R5', 'Field Assembled Anodeless Flexible Riser',
'R6', 'Field Assembled Non-Anodeless Riser',
'RX', 'Other Regulator',
'RP', 'Pilot Regulator',
'RS', 'Service Regulator',
'RR', 'Relief Regulator',
'S1', 'No outlet Mechanical Saddle',
'T0', 'Other Transition Fitting',
'T1', 'Welded end Transition Fitting',
'T2', 'Thread end Transition Fitting',
'T3', 'Flanged End Transition Fitting',
'U0', 'Other Union',
'U1', 'Non-insulated Union',
'UX', 'Insulated Union',
'V0', 'Other Valve',
'V1', 'Ball Valve',
'V2', 'Butterfly Valve',
'V3', 'Check Valve',
'V4', 'Relief Valve',
'V5', 'Gate Valve',
'V6', 'Needle Valve',
'V7', 'Plug Valve');
// look up description for componentType
if (hasKey(d, componentType)) {
return d[componentType];
} else {
return 'Unknown';
}
See this web map for examples of how to use this expression in ArcGIS Online.