Skip to content

message.getASTMRepetitionCount

Use when: You want to read values from the modified message during mapping. If you need the original incoming message, use source.getASTMRepetitionCount.

Signature: message.getASTMRepetitionCount(nodePath, instance*)

Returns: Integer count - the count of repetitions in the field for the nodePath array

Finds the count of repetitions in the field 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 repetitions for the P-6 field.
var pRepetitionCount = message.getASTMRepetitionCount('/P-6'); // expected: 4