Question
How to copy a separate field value with the script to populate each table line?
Answer
Here is an example of how to copy the Date field value to each table row for the LineDate column of the table:
- Open the Document Skill in the editor.
- Open the table element > right-click on the table column header to access Column settings:
- Click New Rule in the settings, scroll down to Advanced Script Rule, select it, and click Next:
- Map fields to be used in a rule: date field and the date column of the table, make sure that the date column is also checked to be changed by this rule. Click Next:
- In the script editor insert and save the below code:
//get the extracted date value
var date = Context.GetField("Date").Value;
//get the collection of table dates
var table_dates = Context.GetFields("Table/LineDate");
//iterate through table dates and assign the extracted date value
table_dates.forEach((element) => {
element.Value = date;
});
As a result, the column is populated with the header field value:
Comments
0 comments
Please sign in to leave a comment.