message.getASTMFieldCount¶
Use when: You want to read values from the modified message during mapping. If you need the original incoming message, use source.getASTMFieldCount.
Signature: message.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¶
// assumes `message` is an ASTM message model object, like:
// H|^~\&|95243|HAMMO001|COMMUNITY AND FAMILY MEDICINE|BOX 2914^DUKE UNIVERSITY MEDICAL CENTER^DURHAM^NC|919-684-6721|||
// 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 = message.getASTMFieldCount('/P'); // expected: 13