Sidebar

I am trying to remove hyphens in the OBX segment.

0 votes
148 views
asked Jun 5, 2023 by gwendoline-s-1248 (160 points)
i have this obx segment that I am separating into new obx segments at the linebreaks. I already have that down, but the hyphens are staying in the segemnts if present. How do I go amount removing them and would they be removed before the original segment is split or after? I've already tried string utils remove and replace but they havent worked. And the hyphens move location dependign on the message, so I cant just code into clear segment 'x'.

 

OBX|1|FT|General Message^General Message|2286305282|---------------------\.br\From: Preston , Charnelle \.br\To: Wesolowski, Andrea;   \.br\Sent: 3/7/2023 12:44:34 PM CST\.br\Subject: PA Remicade \.br\Caller Name: Zztest, Joan; Caller Number: M (920) 333-7777\.br\\.br\Remicade 200m gweek o,2,6 then q 8||||||Auth (Verified)|||20230307134435

 

OBX|1|ST|General Message^General Message||---------------------
OBX|2|ST|From: Preston , Charnelle
OBX|3|ST|To: Wesolowski, Andrea;
OBX|4|ST|Sent: 3/7/2023 12:44:34 PM CST
OBX|5|ST|Subject: PA Remicade
OBX|6|ST|Caller Name: Zztest, Joan; Caller Number: M (920) 333-7777
OBX|7|ST|Remicade 200m gweek o,2,6 then q 8

2 Answers

0 votes

This code would be used to remove the hypens before the OBX segments are combined and will work on any OBX segment where OBX-5='---------------------'.

message.setNode('OBX[@5=---------------------]-5', '');

answered Jun 5, 2023 by amanda-w-3695 (4,840 points)
0 votes

You should be able to use StringUtils.replace(), either before or after you split the OBX-5 segment up.  For example, using

var obx5 = StringUtils.replace(message.getNode('OBX-5'), '-', '') 

will create a variable called 'obx5' that contains the contents of OBX-5, but with all the hyphens removed.  Without seeing the code you're using, it's difficult to show how this will integrate into your specific channel, but here's a sample that will cycle through all OBX segments and remove hyphens from all OBX-5 segments:

for (var i = 1; i <= message.getCount('OBX'); i++) {
   message.setNode('OBX-5', StringUtils.replace(message.getNode('OBX-5', i), '-', ''), i);
}

answered Jun 5, 2023 by jon-t-7005 (7,590 points)
...