Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Auto Populate From Multiple Text Fields

Avatar

Former Community Member
I have a form where I am creating a unique tracking number from various other fields in the form.



Example:



Text Field 1 - Year - Value, "2006"

Text Field 2 - Client ID - Value, "001"

Text Field 3 - Employee Number - Value, "025"

Text Field 4 - File Number - Value, "123456"



Calculated Field (Invoice Number) should then display "2006 001 025 12456"



I have tried TextField1.rawValue = "Field Name.value" and added values with comma's, but i have not been able to pull values from multiple text fields to populate a single text field.
4 Replies

Avatar

Level 7
Have you tried the "Concat(s1 [, s2...])" function in FormCalc?



Be sure to include the spaces.

Avatar

Former Community Member
Yes, I may have written or placed the script wrong, but didnt work.



----- form1.#subform[0].InspectionTest::calculate: - (FormCalc, client) ----------------------------



Concat(Year [, ClientId [, EmployeeNumber [, InvoiceNumber]]])



Script failed (language is formcalc; context is xfa[0].form[0].form1[0].#subform[0].InspectionTest[0])

script=Concat(Year [, ClientId [, EmployeeNumber [, InvoiceNumber]]])

Error: syntax error near token ',' on line 1, column 14.

PDF generated successfully.

Avatar

Level 7
The text shown is the syntax with the optional parameter indicated by the square brackets. For the calculation script for the invoice field:



Concat(Year, " ", ClientId, " ", EmployeeNumber)