Announcement

Collapse
No announcement yet.

Blank Value Replace to ? Issue

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

  • Blank Value Replace to ? Issue

    Hi,

    I want to change the Blank Value to '?', but it work failed. Could you help to check and advise? Many thanks.

    Data Format:
    ---------------
    H|\^&|||Device123||||||||1|20181010094901
    P|1||1254||^|||U||||||||^^^|||||||||
    R|1|^^^pH^M|||^^^|N||F|| (Replace the blank value to '?' e.g R|1|^^^pH^M|?||^^^|N||F|| )
    R|2|^^^pCO2^M||mmHg|^^^|N||F (Replace the blank value to '?' like above)
    R|3|^^^pO2^M|101|mmHg|^^^|N||F

    Transformer code:
    -------------------

    for(var i=0;i<msg['R'].length();i++)
    {
    if( msg['R'][i]['R.3']['R.3.1'].toString() == "")
    {
    msg['R'][i]['R.3']['R.3.1']='?';
    }

    }

    for(var i=0;i<tmp['R'].length();i++)
    {
    if( tmp['R'][i]['R.3']['R.3.1'].toString() =="" )
    {
    tmp['R'][i]['R.3']['R.3.1']='?';
    }
    }

  • #2
    Nothing looks obviously wrong with the code, though I would think you would either change the source msg or the template tmp message rather than both of them.

    Might be useful to have a little more information, so maybe try the following:
    1. Put a logger.debug() as the first line in the for loop to see how many times it executes
    2. Put a logger.debug() inside the if() statement to see if it ever executes
    3. Comment out the code that modifies the tmp for now


    If your msg and tmp objects are largely the same structure, I'd suggest jsut modifying the msg and remove any destination templates you might have.

    Comment

    Working...
    X