source.getASTMFieldCount¶
Use when: You want to read values from the original incoming message before any mapping changes. If you need the modified message during mapping, use message.getASTMFieldCount.
Signature: source.getASTMFieldCount(nodePath, instance*)
Returns: Integer count - the count of fields in the segment for the nodePath array
Finds the count of fields in the segment that matches nodePath.
Note
This method only applies to ASTM formatted messages.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | nodePath | the node path (HPath) | |
| Integer | instance* | (optional) the segment instance to return. Use 1 for the first instance. | 1 |
Example¶
// Given an ASTM source message with a P segment.
/* source:
'H|^~\\&|95243|HAMMO001|COMMUNITY AND FAMILY MEDICINE|BOX 2914^DUKE UNIVERSITY MEDICAL CENTER^DURHAM^NC|919-684-6721|||\r' +
'P|1|999-99-9999|||GUNCH^MODINE^SUE|00279~1&2&3&4^00998~2&3&4&5^00998~3&4&5&6|19430704|F|RT 1, BOX 97^ZIRCONIA^NC^27401||704-982-1234||DOCTOR^PRIMARY^A^^DR. '
*/
// Retrieve the number of fields for the P segment.
var pFieldCount = source.getASTMFieldCount('/P'); // expected: 13