I have multiple groups IN1 segments with IN2 and ZIN segments following.Some insurances have expired in IN1-13. Others are still active. I need to completely remove the entire group IN1, IN2 and ZIN segmement if there is a value in IN1-13.
Some could be expired while others are still active.
IN1|1|505|BLU3|BLUE CROSS BLUE SHIELD OF UTAH|PO BOX 1106^^LEWISTON^ ID^83501||(877)417-6222|||||20180831||||ALLSCRIPTS^ELEPHANT^^^^|SE|19800101|1055 N 500 W^^NOWHEREVILLE^UT^84508|||||||||||||||||789789789789|||||||F|
IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ZIN||||||||||||||||||||||||||||
IN1|2|508|AET4|AETNA GLOBAL BENEFITS|PO BOX 981543^^EL PASO^ TX^79995||(800)231-7729|||||20180901|20181005|||ALLSCRIPTS^ELEPHANT^^^^|SE|19800101|1055 N 500 W^^NOWHEREVILLE^UT^84508|||||||||||||||||456456456456654|||||||F|
IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ZIN||||||||||||||||||||||||||||
IN1|3|510|UMR3|UMR PO BOX 30541|PO BOX 30541^^SALT LAKE CITY^ UT^84130||(800)772-9641|||||20180901||||ALLSCRIPTS^ELEPHANT^^^^|SE|19800101|1055 N 500 W^^NOWHEREVILLE^UT^84508|||||||||||||||||123123123123213|||||||F|
IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ZIN||||||||||||||||||||||||||||
IN1|4|483|BYU1|BYU SPORTS MEDICINE|1130 SMITHFIELD HOUSE^^PROVO^ UT^84602||(801)422-2946|||||20180901||||ALLSCRIPTS^ELEPHANT^^^^|SE|19800101|1055 N 500 W^^NOWHEREVILLE^UT^84508|||||||||||||||||3693369369369|||||||F|
IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ZIN||||||||||||||||||||||||||||
IN1|5|231|CIG7|CIGNA HEALTH|PO BOX 182223^^CHATTANOOGA^ TN^37422||(800)395-8712|||||20180901||||ALLSCRIPTS^ELEPHANT^^^^|SE|19800101|1055 N 500 W^^NOWHEREVILLE^UT^84508|||||||||||||||||456123456132456123|||||||F|
IN2||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ZIN||||||||||||||||||||||||||||
I would expect that the 2nd IN1/IN2/Zin group would be removed due to the expiration date being in IN1-13.
I tried the syntax from the KB article: message.removeAllNodes('OBR[group=!OBR;/OBX-5=*]'); but tried to change it to message.removeAllNodes('IN1[group=!IN1;/IN1-15!=""]'); but it removes all IN1/IN2/ZIN segments instead of the indivdial ones I want to remove. I found I couldn't use the function StringUtils.isNotBlank either in that syntax.
I essentially want to do the same thing in the KB article, but want to remove anything that has IN1-13 that is not blank.