Question
· Apr 20, 2020

Best way to create multiple NTEs from one NTE

- Currently we are receiving one NTE (See Below) from the source system

NTE|1|Result Comment|TESTING:\.br\\.br\This is a test results.  \.br\\.br\This test is a Test.

 

- We would like to create multiple NTE segments and send to destination system by using ".\br\"(Line Break)

NTE|1||TESTING:

NTE|2||

NTE|3||This is a test results.

NTE|4||

NTE|5||This test is a Test.

Bit we are running into compile issue on the code block.  NOt sure if there is a better way to do this.  Any help is greatly appreciated.

code:

 set iTotCnt=$L(sNTE,"\.br\")
 for i1=1:1:iTotCnt d
 . s sTmp=$p(sNTE,i1)
 . s target.{ORCgrp(k1).OBRgrp(k2).OBXgrp(k3).NTE(iNteCnt)} sTmp
 . s iNteCnt=iNteCnt+1

Discussion (1)0
Log in or sign up to continue

Rather than:

s target.{ORCgrp(k1).OBRgrp(k2).OBXgrp(k3).NTE(iNteCnt)} sTmp

Try:

d target.SetValueAt(iNteCnt, "ORCgrp("_k1_").OBRgrp("_k2_").OBXgrp("_k3_").NTE("_iNteCnt_"):1")
d target.SetValueAt(sTmp, "ORCgrp("_k1_").OBRgrp("_k2_").OBXgrp("_k3_").NTE("_iNteCnt_"):3")

Assuming you want the value in the 3rd field of the NTE. You should also change the value stored in sNTE to:

source.{ORCgrp(k1).OBRgrp(k2).OBXgrp(k3).NTE(1):3}

If there's only one NTE segment in each OBXgrp of the the inbound message.