Get instance count from table/repeating group?????

  • 536 Views
  • Last Post 3 days ago
lliu posted this 13 May 2015

Is there a way to use scripting to get instance count from a table/repeating group in FlexiLayout or Document Definition? So that I don’t need to export table in Layout, or export table in Document Definition.

Order By: Standard | Newest | Votes
Sushi posted this 09 June 2015

Lliu,

Its probably too late but you should be able to count the lines in DocDef. Basically you need to make the rule at the section level.

Basically pick a field on the table and use something like me.Items.Count

  • Liked by
  • hawkeye69
lliu posted this 09 June 2015

Problem solved. Couldn't find the table element in script, fix: need to add that element in the rule first.

PS. I hate that I can't delete or edit(save edited) post on this forum.

hawkeye69 posted this 3 days ago

Lliu,

Its probably too late but you should be able to count the lines in DocDef. Basically you need to make the rule at the section level.

Basically pick a field on the table and use something like me.Items.Count

  I found this to be very important. If you put this code at the repeating group or field level, you get errors that the object doesn't exist. Let me add some sample script as well. The name of my Repeating Group in this case is "Codes"  

if (Context.Field("Codes").Items.Count > 12)

{    

   Context.CheckSucceeded = false;    

   Context.ErrorMessage = "The system will only process up to 12 codes.";

}

Adrian Enders

Close