These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Combine Two text strings

ditraub
Registered: Nov 13 2009
Posts: 11
Answered

I need to combine two text fields, 'ReportTitle' and 'ReportDate', into one field called 'HeaderLine' to display the text string of 'ReportTitle' [space] 'ReportDate'. They are each wrapped at different levels of subforms, and I cannot get the syntax right, and end up displaying nothing at all or a 'zero'.

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Have you looked at using the 'Concat()' fucntion?

George Kaiser

ditraub
Registered: Nov 13 2009
Posts: 11
I have not used the Concat() function yet and the Adobe reference guide is of little help. The code I tried is:

var sTitle = xfa..ReportTitle.value;
var sDate = xfa..ReportDate.value;
var recorder = "";
HeadLiner.rawValue = recorder.concat(sTitle, " ", sDate);

I did not get any errors, but the field remains blank. I am sure I have something wrong.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
When I try to preview your code I get a pop up with and error because of the '..'.

The simplest code in FormCalc for the calculation event for the 'HeadLiner' field:
Concat(ReportTitle, " ", ReportDate)
This assumes the 'ReportTitle' and 'ReportDate' are within the same subform and do not need a full reference.

If you want to use variables and field properties the calculation action can be:
var sTitle = ReportTitle.rawValuevar sDate = ReportDate.rawValue$.rawValue = Concat(sTitle, " ", sDate)

George Kaiser

ditraub
Registered: Nov 13 2009
Posts: 11
The variable call code works perfectly, thank you.