Announcement

Collapse
No announcement yet.

Processing message elements in a transformer

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

  • saboor
    replied
    Maybe you could redirect localhost on your box to the proper IP? You would use the hosts file in windows to do this.


    _______________________________
    http://crave4leather.com
    Last edited by saboor; 11-12-2016, 04:00 AM.

    Leave a comment:


  • djfmirth
    replied
    Re:Processing message elements in a transformer

    This works:

    Code:
    var count = 0;
    var nokArray = new Array();
    
    for each (nk1 in msg..NK1) {
      first = nk1['NK1.2']['NK1.2.1'];
      middle = nk1['NK1.2']['NK1.2.2'];
      surname = nk1['NK1.2']['NK1.2.3'];
      name = first + " " + middle + " " + surname;
    
      logger.info("Name: [" + name + "]"«»);
      nokArray[count] = name;
      count++;
    }
    but I was expecting a dot means of traversing the tree (eg nk1.2.1 etc) - is that possible?

    Leave a comment:


  • djfmirth
    replied
    Re:Processing message elements in a transformer

    This works:

    Code:
    var count = 0;
    var nokArray = new Array();
    
    for each (nk1 in msg..NK1) {
      first = nk1['NK1.2']['NK1.2.1'];
      middle = nk1['NK1.2']['NK1.2.2'];
      surname = nk1['NK1.2']['NK1.2.3'];
      name = first + " " + middle + " " + surname;
    
      logger.info("Name: [" + name + "]"«»);
      nokArray[count] = name;
      count++;
    }
    but I was expecting a dot means of traversing the tree (eg nk1.2.1 etc) - is that possible?

    Leave a comment:


  • djfmirth
    replied
    Re:Processing message elements in a transformer

    This works:

    Code:
    var count = 0;
    var nokArray = new Array();
    
    for each (nk1 in msg..NK1) {
      first = nk1['NK1.2']['NK1.2.1'];
      middle = nk1['NK1.2']['NK1.2.2'];
      surname = nk1['NK1.2']['NK1.2.3'];
      name = first + " " + middle + " " + surname;
    
      logger.info("Name: [" + name + "]"«»);
      nokArray[count] = name;
      count++;
    }
    but I was expecting a dot means of traversing the tree (eg nk1.2.1 etc) - is that possible?

    Leave a comment:


  • djfmirth
    replied
    Re:Processing message elements in a transformer

    This works:

    Code:
    var count = 0;
    var nokArray = new Array();
    
    for each (nk1 in msg..NK1) {
      first = nk1['NK1.2']['NK1.2.1'];
      middle = nk1['NK1.2']['NK1.2.2'];
      surname = nk1['NK1.2']['NK1.2.3'];
      name = first + " " + middle + " " + surname;
    
      logger.info("Name: [" + name + "]"«»);
      nokArray[count] = name;
      count++;
    }
    but I was expecting a dot means of traversing the tree (eg nk1.2.1 etc) - is that possible?

    Leave a comment:


  • djfmirth
    replied
    Re:Processing message elements in a transformer

    This works:

    Code:
    var count = 0;
    var nokArray = new Array();
    
    for each (nk1 in msg..NK1) {
      first = nk1['NK1.2']['NK1.2.1'];
      middle = nk1['NK1.2']['NK1.2.2'];
      surname = nk1['NK1.2']['NK1.2.3'];
      name = first + " " + middle + " " + surname;
    
      logger.info("Name: [" + name + "]"«»);
      nokArray[count] = name;
      count++;
    }
    but I was expecting a dot means of traversing the tree (eg nk1.2.1 etc) - is that possible?

    Leave a comment:


  • djfmirth
    started a topic Processing message elements in a transformer

    Processing message elements in a transformer

    I'm trying to write a transformer that handles an HL7 message that has variable segments. I've concocted the following fictitious message:

    MSH EVN PID [NK1]

    ie zero or more NK1 segments.

    I've written the following (abominable) JavaScript code to iterate across these segments and extract and concatenate the required data:

    Code:
    var count = 0;
    var nokArray = new Array();
    var first = "?";
    var middle = "?";
    surname = "?";
    var name = "?";
    
    
    for each (nk1 in msg..NK1) {
      first = msg['NK1'][count]['NK1.2.1'].toString();
      middle = msg['NK1'][count]['NK1.2.2'].toString();
      surname = nk1['NK1']['NK1.2']['NK1.2.3'].toString();
      nokArray[count] = first + "_" + middle + "_" + surname;
      count++;
    
    //  first = msg['NK1'][count]['NK1.2.1'];
    //  first = nk1.NK1.2.1.1;
    //  first= nk1.2.1.1;
    }
    
    logger.info('nokcount = ' + count);
    channelMap.put('nokcount', count);
    channelMap.put('noks', nokArray.toString());
    channelMap.put('fms', first + "/" + middle + "/" + surname);
    The 'for each' iteration works ok but extracting the first, middle and surname fields always returns a blank. Commented out are some attempts to use the iteration variable to access these fields - they also either return a blank or cause the channel not to be deployable.

    Could someone kindly point out the error of my ways or point me at some working example - I search the forum but found nothing that worked for me.

    Thanks,
    David
Working...
X