Expand my Community achievements bar.

SOLVED

Hiding Cell Value in a Table

Avatar

Level 2

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 Accepted Solution

Avatar

Correct answer by
Former Community Member

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

View solution in original post

7 Replies

Avatar

Former Community Member

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?

Avatar

Level 2

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.

Avatar

Former Community Member

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

Avatar

Level 2

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

Avatar

Correct answer by
Former Community Member

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

Avatar

Level 2

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

Avatar

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----