1 Reply Latest reply on Feb 11, 2009 11:53 AM by StefCameron

    Counting instances?

    AKCourtney
      I am completely new to lifecycle and I am having difficulty with a form. It is a relatively simple form; however in the section of the form with a table for invoice items I am having some difficulty. The problem is: an expanding table to allow the end user to add a row for additional invoice items and then it calculates a total item and grand total for the invoice.

      I would like to have the item number generated automatically 1,2,3,4, ect but right now it starts at 0 (I think that might defeat the purpose of numbering items). I think this is counting the instances? I am not sure =(

      Sorry if I did not adhere to the proper forum etiquette, or if I posted in the wrong place. I dont really know the ins and outs of this whole thing and I could really use some help!!

      Here is the scripting in the form:(I think I need to change the first one, but how!?!)

      // This script displays the instance value of the row in this text field.

      // Invoke the Instance Manager to add one instance of the detail subform.

      details._detail.addInstance(1);

      //Invoke the recalculate method to include the field values from the added row in calculations.

      // Invoke the Instance Manager to remove the current instance of the detail subform.
        • 1. Re: Counting instances?
          StefCameron
          Courtney Wilkins,

          For future reference, the proper Adobe Forum to post such questions is the LiveCycle Designer ES forum.

          Have a look at the "Purchase Order -- Dynamic Interactive" sample that ships with Designer. You'll find it in the following folder:

          {Designer_install_location}\{version}\EN\Samples\Forms\Purchase Order\Dynamic Interactive\Forms

          It's a great example of a dynamic table with various sums.

          As for the "item number", I'm assuming you mean the row index. If that's the case, then lets say you have a cell in your repeatable table row named "RowIndex" which is a text field. Also assuming you're running Designer 8.0 or later, you would add the following script to the row's IndexChange event (in JavaScript):

          RowIndex.rawValue = (this.index + 1) + ".";

          For more info, you could try the following posts and comments on my blog: Calculate Scripts and Instance Manager Object Reference.

          Stefan
          Adobe Systems

          More answers at Stefan Cameron on Forms.