Expand my Community achievements bar.

How to get rid of null value when combining rawValue data.

Avatar

Level 1

Hi, I am working in LiveCycle ES4 Designer. I have an issue with combining rawValue data from multiple fields into one field. I am VERY green when it comes to javascript. Please Help!

LiveCycleQuestions.jpg

Thanks so much for any help!!!

6 Replies

Avatar

Employee

Before concatenating strings, check the value middle initial. If it is null, use the expression:

this.raValue = FirstName.rawValue + LastName.rawValue;

Avatar

Level 1

Still Very green with javasript. sorry...

How do I check the value?

Avatar

Level 1

OK, by sheer dumb luck, I managed to come up with something that works....

this.rawValue = FirstName.rawValue + " " + MidInitial.rawValue + "." + " " + LastName.rawValue;

 

if (MidInitial.rawValue == null){

this.rawValue = FirstName.rawValue + " " + LastName.rawValue;

}

Have a good one!

Avatar

Employee

Use this:

if (MidInitial.rawValue == null) {

          this.rawValue = FirstName.rawValue + LastName.rawValue;

}

else {

          this.rawValue = FirstName.rawValue + MidInitial.rawValue + LastName.rawValue;

}

Avatar

Level 8

This is what I use:

this.rawValue = (FirstName.isNull ? "":FirstName.rawValue+" ") + (MidInitial.isNull ? "":MidInitial.rawValue+" ") + (LastName.isNull ? "":LastName.rawValue);

Both work.

Kyle