7 Replies Latest reply on Jan 10, 2012 1:16 AM by BapediBoupi

    Hiding Cell Value in a Table

    cclay53

      If a cell in a table is less than a certain value how do you make that hidden? Which then also means if a cell value is greater than a certain value it can be seen.

        • 1. Re: Hiding Cell Value in a Table
          Ida Eve Level 2

          Can you provide more information on what you are trying to do.  Is your cell pulling data from a datasource or is the user manually entering the data in?  I assume the field is numeric?

          • 2. Re: Hiding Cell Value in a Table
            cclay53 Level 1

            I am taking a calculated value from a cell and adding it to a entered value from another cell. If that sum is less than 8 i do not want the value showing. If the value is greater than 8 then I want that sum minus 8 to be shown. Also does this need to be a text or numeric field?

            Thanks.

            • 3. Re: Hiding Cell Value in a Table
              BapediBoupi Level 1

              Hi,

               

              To show / hide a field, you can use the "presence" attribute. For example on your calculate event, something like :

               

              if (this.rawValue <8) {

                   this.presence = "hidden";

              } else {

                   this.rawValue = this.rawValue - 8;

                   this.presence = "visible";

              }

               

              Your field should be a numeric field if you're doing calculation on it.

               

              Hope this helps,

               

              Regards,

               

              Thomas

              • 4. Re: Hiding Cell Value in a Table
                cclay53 Level 1

                I started with this line of code because I need to establish what the raw value is. Correct? And this works it totals up the 2 cells and puts their sum in this cell.

                 

                So I added the code you suggested and changed the type to numeric field and that cell shows no values.  

                 

                 

                this.rawValue=(Row6.ph2 + Row7.Cell3)

                 

                if (this.rawValue <8) {

                     this.presence = "hidden";

                } else {

                     this.rawValue = this.rawValue - 8;

                     this.presence = "visible";

                }

                 

                 

                Thanks

                Craig

                 

                 

                • 5. Re: Hiding Cell Value in a Table
                  BapediBoupi Level 1

                  Hi,

                   

                  Are Row6.ph2 and Row7.Cell3 numeric fields ?

                   

                  It seems that you're using Javascript. In this case, you should access the value of a field using rawValue (ie Row6.ph2.rawValue).

                   

                  You also need to give a relative (this.parent ...) or absolute path (xfa.resolveNode("form.table.Row7")) to access Row6 and Row7, for example :

                   

                  this.rawValue=(Number(this.parent.Row6.ph2.rawValue) + Number(this.parent.Row7.Cell3.rawValue));

                  if Row6 and Row7 are in the same subform as the total field.

                   

                  After testing the script quickly, it seems that if you put the rest of the script in the layoutReady event, it works fine.

                   

                  if (this.rawValue <8) {

                       this.presence = "hidden";

                  } else {

                       this.rawValue = this.rawValue - 8;

                       this.presence = "visible";

                  }

                   

                  I don't really know why it doesn't work in the calculate event, there is no error in the javascript console ...

                   

                  Anyway, be careful with the layoutReady event though, because if you have a really big form and a lot of script in this event, this could slow the execution / display of your form.

                   

                  Regards,

                   

                  Thomas

                  • 6. Re: Hiding Cell Value in a Table
                    cclay53 Level 1

                    I tried using this.parent and that did not work. So I named the cells in row 7 and then used this.rawValue= in the calculate field with the other script in the layout ready field.and that worked except it hides the entire cell not just the value, So I have an entire row of cells in the table that has no borders unless there is a value in it.

                     

                    I again made a code change. Instead of using this.presence = "hidden", I changed it to this.rawValue = "" and it worked.

                      

                    Thank you for all your help. It is greatly appreciated!

                     

                    Craig

                     

                    Message was edited by: cclay53

                     

                    Message was edited by: cclay53

                    • 7. Re: Hiding Cell Value in a Table
                      BapediBoupi Level 1

                      this.parent only retrieves the parent object of the one you're putting the script on. You may need to use this.parent.parent.textField for example. Another way to find your field (your node) is xfa.resolveNode("SOMEXPRESSION"); this function returns the node of the somExpression.

                       

                      You can't hide only the value, but you can hide all the field. What you can do is wrap your field in a subform and draw a border on this subform. This way if you hide the numericField, you can still see a border !

                       

                      You can use this.rawValue = "";, but you loose your value if you want it later ... Depends of your needs.

                       

                      I saw you asked about a scripting reference manual, but since your message was edited I think that you found it. Anyway I'll post the link for others that could need it : http://help.adobe.com/en_US/livecycle/es/lcdesigner_scripting_reference.pdf

                       

                      Regards,

                       

                      Thomas