5 Replies Latest reply on Mar 11, 2010 5:58 AM by pguerett

    Problem wtih a table

    p9io

      Hi,

      sorry for my bad English.

      I have a problem with a table. I have done a table with some script but when I add a new line, this script don't work in the new line or lines. I know I have something wrong but I don't know the solution. Can anyboy help me? You can see the file in http://www.frmgm.jazztel.es/duda.pdf. I am new in the programming matter.

      Thank so much.

        • 1. Re: Problem wtih a table
          pguerett Level 6

          I am not sure I understand what the problem is .....are you saying you cannot add lines to the table?

           

          Paul

          • 2. Re: Problem wtih a table
            p9io Level 1

            Hi. I can add line or lines but when I add line the script don't work in the new line or lines. For example, in the first line if the firts check box don't be select the second check box can't be select but when I add a new line this script don't work. I hope the explanation was correct.

            Thank you so much.

            • 3. Re: Problem wtih a table
              pguerett Level 6

              Ok now I understand ......each row that you add to the table changes the somExpression for the objects (so that they are unique). The repeating subform gets an occurance number but the rest of the expression remains the same. If you do not include an occurance number then the 1st occurance is assumed ...that is why only the 1st row is affected. You will have to construct the expressions so that you can derive the correct occurance number. The click event code would look like this:

               

              if (xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación1.rawValue == "0") {
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación2.access = "readOnly";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación3.access = "readOnly";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación4.access = "readOnly";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").Botón1.presence = "hidden";
                } else {
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").Botón1.presence = "visible";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación1.access = "readOnly";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación2.access = "open";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación3.access = "readOnly";
                xfa.resolveNode("Tabla1.Fila1[" + this.parent.index + "]").CasillaVerificación4.access = "readOnly";
                  }

              You can see that the xfa.resolveNode accepts a string representing the object that we want to use. The string is then constructed and the occurance number of the Fila1 subform is derived by getting the index number of the parent subform of the object that we have clicked (this.parent.index). Occurane numbers are wrapped in square brackets [].  The rest has not changed. You will have to update all of your code to use this technique.

               

              Hope that helps

               

              Paul

               

               

               

              • 4. Re: Problem wtih a table
                p9io Level 1

                Thank you very much. But I have another questions about table. Now the script work correctly in the new lines but is possible to say that the script don't work in old lines and only work in the new line created?

                Best regards.

                • 5. Re: Problem wtih a table
                  pguerett Level 6

                  When we add a line we know that the index of the row we are working on woudl be the count of subforms - 1 (the occurances are 0 based). If there is code between objects then you have to figure out which row you are on so instead of getting a count for the index you need to find a way to get the index of the row you want to affect. In most cases an object from the same row is used to trigger the code so you can use this.parent.index to get the occurance of the parent node.

                   

                  Then you need to modify your object references to include the indexes (like my code does) but instead of using the count you woudl use the index that you derived.

                   

                  Make sense?

                   

                  Paul