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

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.

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.";