Community

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.
0

Comments

3 comments

  • Avatar
    Sushi
    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
    1
  • Avatar
    lliu
    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.
    0
  • Avatar
    Adrian Enders

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

    }

    0

Please sign in to leave a comment.