Skip to content

Create new AL1 segments based on specific data in PID 35 #6405

Answered by pacmano1
Roundy88 asked this question in Q&A
Discussion options

You must be logged in to vote
var values = ['SG>', 'DEM>'];

var found_first = false;
var AL
var index = 1

for each(var stuff in msg['PID']['PID.35']) {
    if (values.includes(stuff['PID.35.1'].toString())) {
        if (!found_first) {
            AL = createSegmentAfter('AL1', msg['PD1']);
            found_first = true;
        } else {
            AL = createSegmentAfter('AL1', AL);
        }
        AL['AL1.1'] = index
        AL['AL1.2'] = stuff['PID.35.1'].toString()
        index++
    }
}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@Roundy88
Comment options

@pacmano1
Comment options

Answer selected by Roundy88
@pacmano1
Comment options

Comment options

You must be logged in to vote
1 reply
@Roundy88
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants