Avatar

Level 2

Hi I am concatinating numerous fields in to one t

show it one filed in the form as below(Steve has helped me on this).

if

(xfa.resolveNode("Page7.Q2a01_TX").rawValue.isNull) {

str

= str;

}

else

{

str

= xfa.resolveNode("Page7.Q2a01_TX").rawValue;

}

if

(xfa.resolveNode("Q2a02_TX").isNull) {

str

= str + "";

}

else

{

str

= str + "\n" + xfa.resolveNode("Q2a02_TX").rawValue;

}

if

(xfa.resolveNode("Q2a03_TX").isNull) {

str

= str + "";

}

else

{

str

= str + "\n" + xfa.resolveNode("Q2a03_TX").rawValue; so on till 40 ...

the RESULT now is   as

Testing for question1

Testing for question2

Testing for question3

Testing for question4

but now i want to add "Q1" , "Q2" etc before by modifying as below which is understandbily not correct as

if

(xfa.resolveNode("Page7.Q2a01_TX").rawValue.isNull) {

str

= str;

}

else

{

str

= "Q1" +  xfa.resolveNode("Page7.Q2a01_TX").rawValue;

}

if

(xfa.resolveNode("Q2a02_TX").isNull) {

str

= str + "";

}

else

{

str

= str + "\n" +"Q2"+ xfa.resolveNode("Q2a02_TX").rawValue;

}

if

(xfa.resolveNode("Q2a03_TX").isNull) {

str

= str + "";

}

else

{

str

= str + "\n" +"Q3"+  xfa.resolveNode("Q2a03_TX").rawValue; so on till 40 ...

BUT THE RESULT NOW WOULD BE

Q1 Testing for question1

Q1 Q2 Testing for question2

Q1 Q2 Q3 Testing for question3

Q1 Q2 Q3 Q4 Testing for question4

How can i just make the script to say

Q1 Testing for question1

Q2 Testing for question2

Q3 Testing for question3

Q4 Testing for question4

I am a novice in JS ,  can somebody haelp me on this.

Thanks In advance

De1209