Announcement

Collapse
No announcement yet.

string replacement

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

  • string replacement

    When one of my variables contains no data I want to replace it with the text NA and I can't figure out how to do it in string replacement if there is no string in the first place. Is there a way to say if the var is blank or null in the string replacement options?

  • #2
    Re: string replacement

    Here's a sample:
    Code:
    // Get patient SSN with "-" removed
    var tempSSN = "";
    if (pidSegment['PID.19'] != null) {
        tempSSN = pidSegment['PID.19'].toString();
        if (tempSSN.length > 0) {
           tempSSN = tempSSN.replace(/-/g, "");
       }
        else {
           tempSSN = 'NA';
        }
    }

    Comment


    • #3
      Re: string replacement

      You can use the "default value" part of the mapper - if the value is empty of undefined it will use default value. (default value can contain any JS code or other mappings).

      -Chris
      Chris Lang

      Comment


      • #4
        Re: string replacement

        Also, you could include a regex like:

        "" replace with "your value"

        or

        /.*/g, "your value"

        or

        ".*", "your value"

        Try those also.
        Chris Lang

        Comment

        Working...
        X