7 Replies Latest reply on Jan 31, 2014 7:34 AM by bmklaver

    Incrementing numbered bullets

    bmklaver

      I'm looking for script that can do the following in addtion to hope that Adobe develops a means to allow for bulleting without writing script.

      A flat PDF will be created after data is rendered with a template.  The data will determine the number of text boxes that will be hidden or displayed.  For each text box within a section that is displayed, I need to have a numbered bullet.  I know how to do this for a repeating subform (only because I've copied code) but not for mulitple text boxes.  I have a floating field next to a sting of text within the text box for each text box. 

        • 1. Re: Incrementing numbered bullets
          Magus069 Level 4

          I don't know how is your form's design, but you can create a table with only one row, one column, no header and no footer which create a kind of Subform.

          You can add instances to this row which contains your textbox and your text inside it.

          To get a numbered bullet you can just get the maximum count of the instance row and return this number to be your bullet.

           

          lblText.rawValue = Table1.Row1.instanceManager.count.toString() + "\t" + strContent;

           

          e.g.

          for (var i = 0; i < Table1.Row1.instanceManager.count.toString(); i++){

               this.resolveNode("Table1.Row1[" + i.toString() + "].frmText.lblText").rawValue = Table1.Row1.instanceManager.count.toString() + "\t" + "Insert any text here!";

          }

          • 2. Re: Incrementing numbered bullets
            bmklaver Level 1

            Thanks for the reply.  It would look something like this...

             

            1.  Completed W9 signed by <field>

            2.  Proof of insurance in <field2> name.

            3.  Drivers License for <field3>.

            4.  Deed for on primary residence.

             

            or in other words

             

            <bullet field> text1

            <bullet field2> text2

            <bullet field3> text3

            <bullet field4> text4

             

            Given your suggestion, I would then create a table with 4 rows and 1 column.  A floating field for the numeric bullet and the hardcoded text tabbed to the right strung with field.  Each row would then be determined to be hidden or displayed based on the field's value being null or something similar.  If for example 3 and 4 are to be present only, then 3 would actually be displayed as bullet 1.  and 4 would be displayed as bullet 2.  Number 4 would obviously require a field to bind to so it has an instance.  So the question would be what my script would look like.  I am not a script writer so this is all new to me.

            • 3. Re: Incrementing numbered bullets
              Magus069 Level 4

              mhmm not sure what you are trying to do... but i'd try something like that...

               

              //Counts how many rows are visible

              var intVisible = 0;

               

              //loop to go through all rows

              for (var i = 0; i < xfa.resolveNode("Table1.Row1[0]").instanceManager.count; i++){

                   //if the row is visible

                   if (xfa.resolveNode("Table1.Row1[" + i.toString() + "]").presence == "visible"){

                        //add one to Visible count

                        intVisible += 1;

                        //Insert text into label

                        xfa.resolveNode("Table1.Row1[" + i.toString() + "].frmText.lblText").rawValue = intVisible.toString() + ". text here...";

                   }    

              }

              • 4. Re: Incrementing numbered bullets
                bmklaver Level 1

                I'm assuming this is a Formready event at the on the table object?

                • 5. Re: Incrementing numbered bullets
                  bmklaver Level 1

                  Here's how I'm imagining this working without knowing script...lol...

                   

                  RowInstance = 0

                  Loop through Table

                  Looks at Row 1, Row1,Field1 is null, do not display, //row instance would equal zero because hidden

                  Looks at Row2, Row2,Field2 is not null, display, add 1 to RowInstance, BulletField2 = RowInstance  //row instance would = 1

                  Row3..Field3 is not null, display, add 1 to RowInstance, BulletField 3 = RowInstance //row instance would = 2

                  Row4, etc

                   

                  Would I be using a global variable anywhere here?

                   

                  Also, instanceManager does not appear when typing script in the dropdown as a prefillable script.  I have ES2.  ?

                  • 6. Re: Incrementing numbered bullets
                    Magus069 Level 4

                    if you have Row1; Row2; Row3 instead of Row1[0]; Row1[1]; Row1[2], that means you have a table with fixed dimension...

                    So you can't use instances on those rows...

                     

                    Your global variable would be :  var intVisible = 0; -> this var is to check how many textfield are not null, or if you prefer, how many rows are visible

                     

                    of course the following code MUST be adjusted according to the interface of your form... you can't use the same names as I'm using if your objects are not specifically set in that same order and has the same names...

                     

                    // instanceManager can work on with Row1.instanceManager but i may cause errors (sometimes),

                    // using Row1[0].instanceManager is making sure to use your first row in the table (the only row you can't delete)

                    //

                    for (var i = 0; i < xfa.resolveNode("Table1.Row1[0]").instanceManager.count; i++){

                     

                         //if the row is visible

                         //

                         if (xfa.resolveNode("Table1.Row1[" + i.toString() + "]").presence == "visible"){

                     

                              //add one to Visible count

                              //

                              intVisible += 1;

                     

                              //Insert text into label

                              //Here the syntax is to insert a string value into a label which is inside the table.Row1[x]...

                              //

                              xfa.resolveNode("Table1.Row1[" + i.toString() + "].frmText.lblText").rawValue = intVisible.toString() + ". text here...";

                         }   

                    }

                     

                     

                     

                    I am working with ES2 as well, look through the JavaScript LiveCycle Reference Guide for help

                    -> http://help.adobe.com/en_US/livecycle/es/lcdesigner_scripting_reference.pdf

                     

                    And you can also go look some tutorials on youtube with True Tech TroubleShooting, very good introduction to LiveCycle

                    http://www.youtube.com/watch?v=jWrq6agoCfU

                     

                    Browse through his videos and you will be able to make what you want with those..

                    • 7. Re: Incrementing numbered bullets
                      bmklaver Level 1

                      Thanks.  This is great information that opens up more possibilities to explore. Appreciated.