Announcement

Collapse
No announcement yet.

How do I transform this message?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I transform this message?

    I'm a complete noob...

    Can anyone tell me what I need to do to accomplish the following?

    If OBR10 is a number instead of IP address, like in example 1. Get the IP address from the DEVICEIP field minus the port and apply it to OBR10 like in Example 2.

    Example 1
    OBR||||treatment^^message|||20211119131830|||20000 |
    OBX|1|ST|DEVICETYPE||MACHINE||||||F|
    OBX|2|ST|DEVICEID||20000||||||F|
    OBX|3|ST|DEVICEIP||192.168.1.10:5000||||||F|


    Example 2
    OBR||||treatment^^message|||20211119140057|||192.1 68.1.20|
    OBX|1|ST|DEVICETYPE||MACHINE||||||F|
    OBX|2|ST|DEVICEIP||192.168.1.20:5000||||||F|

  • #2
    Please read the forums etiquette at https://forums.mirthproject.io/artic...orum-etiquette.

    At least post your try next time.

    This code looks at all OBX and if a ':' is in OBX-5.1 sets OBX-10.1 as asked

    PHP Code:
    for each (obx in msg..OBX) {
        if (
    obx['OBX.5']['OBX.5.1'].toString().indexOf(':') != -1) {
            
    obx['OBX.10']['OBX.10.1'] = obx['OBX.5']['OBX.5.1'].toString().split(':')[0]
        }

    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Sorry and thanks, I'll give that a try.

      Comment


      • #4
        The code above didn't seem to have any effect on the message.

        If this line is an OBR segment, wouldn't the code have to include OBR.10 instead of OBX.10?

        OBR||||treatment^^message|||20211119140057|||192.1 68.1.20|

        Comment


        • #5
          I only showed a way to check segments for the string, i didn’t answer your exact question.

          So yes, I am inspecting the wrong segment.
          Diridium Technologies, Inc.
          https://diridium.com

          Comment


          • #6
            I was able to figure out with your help. Thanks a lot.

            Comment

            Working...
            X