How to get the number of the table rows and populate a field with it?

Question

In the document skill, there is a field called Line Count and it should be populated with the number of lines that are in the Line Items table. Is there a way to get a count of the lines from the table and populate the Line Count field with it?

 

Answer

  1. Create a field Line Count (data type set to Text):

  2. Create an Advanced Script Rule for the field with the sample script as per below:
    var myTable = Context.GetField("Line Items"); 
    Context.GetField("Line Count").Value = myTable.Instances.length.toString();
  3. Please note, that both the whole Line Items group and the Line Count field should be enabled in the rule settings:
  4. The result is the following:

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.