Solved

Concatinate addr fields in Javascript for Livecycle designer

Posted on 2014-09-20
9
425 Views
1 Endorsement
Last Modified: 2014-09-20
Hi , I am trying to concatenate addr fields for the text field in the live cycle designer using java script  as below

this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue || "\n"
                   if((xfa.resolveNode("#subform[1].Addr2").rawValue)!= null)
                    {
                    xfa.resolveNode("#subform[1].Addr2").rawValue}
                    else
                    {xfa.resolveNode("#subform[1].City").rawValue||xfa.resolveNode("#subform[1].State").rawValue||xfa.resolveNode("#subform[1].Replyzip").rawValue

Open in new window


but i am only getting the CAO name and addr1 on my forms even though i have values for addr2, city, state , zip

can somebody help me to understand if the formula in have in the script layout is correct.


Thanks
de1209
1
Comment
Question by:Koushik Anna
  • 4
  • 3
  • 2
9 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Where you are using || you should be using +
0
 

Author Comment

by:Koushik Anna
Comment Utility
Thank you Gary , i tried as below , but doesnt seem to work , any advice

this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n"
                   if((xfa.resolveNode("#subform[1].Addr2").rawValue)!= null)
                    {
                    xfa.resolveNode("#subform[1].Addr2").rawValue +"\n" + xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue }
                    else
                    {xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue
                    }
0
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Any error?
Are you sure this is returning a null value and not just a blank or undefined value?
xfa.resolveNode("#subform[1].Addr2").rawValue)!= null

If you alert the values do you get the values?
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
Try this :
this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";
this.rawValue += ( xfa.resolveNode("#subform[1].Addr2").rawValue  || "") + ( xfa.resolveNode("#subform[1].City").rawValue || xfa.resolveNode("#subform[1].State").rawValue || xfa.resolveNode("#subform[1].Replyzip").rawValue );

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Koushik Anna
Comment Utility
I tried you script, if the addr2 field is null its is returning as

Name
Addr1
null
State, city zip.
trying to avoid the null if there is no addr2.
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
Strange...
Try this one :
this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";
this.rawValue += (xfa.resolveNode("#subform[1].Addr2").rawValue  == null) ?"": xfa.resolveNode("#subform[1].Addr2").rawValue;
this.rawValue +=   xfa.resolveNode("#subform[1].City").rawValue || xfa.resolveNode("#subform[1].State").rawValue || xfa.resolveNode("#subform[1].Replyzip").rawValue;

Open in new window

0
 

Author Comment

by:Koushik Anna
Comment Utility
Thank you Gary, it worked.  but one last question
what does " += " indicate..?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
Gary? I'm leakim971...

this.rawValue = this.rawValue +
same as :
this.rawValue +=
0
 

Author Comment

by:Koushik Anna
Comment Utility
Thank you very much leakim971, and i am extremely sorry for the name mess up ,  i apologize.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
I'd like to talk about something that is near and dear to my heart: build systems. Without them, building software is all about compiling locally, with software versions everywhere. It can be a mess. Today we are going to discuss building a small di…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now