Download and unzip the assets related to this article
Import the UsingTableInCM.cmp by pointing your browser AEM Forms
Preview the letter
In this article we will take a look at using dynamic tables in AEM Forms Correspondence Management. Tables are very popular options to display tabular data. Sometimes you may have the need to display the total of particular column as shown in the screen shot below. In this example we are displaying the stock holdings of an fictitious customer. Using the formcal script we have calculated the Total and the Grand Total.
To calculate the total we have used a simple fomula Sum(Quantity * PricePaid)
To calculate the Grand Total we have used the sum(Table1.StockHoldings[*].Total[*]).
The Sum function is out of the box function of the FromCalc lanaguage that come with AEM Forms Designer.
To use dynamic tables in CM you will have to do the following
Design the table using Forms Designer. Make sure the table is dynamic
Design the Data Dictionary in CM to reflect the columns in the table. The screen shot below shows you the Data Dictionary that has been created for this sample. Notice the DatePurchased .....Quantity elements which represent the columns in the table.
Upload the xdp which has the table in to AEM Forms
Create Layout Fragment using the uploaded XDP
Use this Layout Fragment as any other Document Fragment. You can insert this Layout Fragment into the appropriate target area