These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

how to hide the first instance of a subform

ebbo1983
Registered: Mar 16 2009
Posts: 93
Answered

I have a specific scenario where the first instance of my subform will always have '0' as its value. Therefore I would like to hide the first instance only. how can i do this?

note:
The sub form is on a non-fixed page, it can start on any page.

I guessed the following:

if (table_2_carryforward.instanceManager.index == 0){
this.presence = "hidden";
}

it does hide the first instance, but it seems to hide every other instance too. all help appreciated!

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can use an accessor to get a specific instance of an object.
[0] means the first instance of a object, [1] the second, [2] the third ... and so on.

table_2_carryforward[0].presence = "hidden";
or
xfa.resolveNode("table_2_carryforward[0]").presence = "hidden

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ebbo1983
Registered: Mar 16 2009
Posts: 93
that does not work for me, i get the following errors:

table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
table_2_carryforward[0] has no properties
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[13]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
unterminated string literal
2:XFA:form1[0]:table_2_rows[32]:table_2_headings[0]:table_2_carryforward[0]:initialize
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Ok, can you be a bit more precisely?

Where did you place the script?
Which one of my example did you use?
How is you form structured?

I tested the code on one of my forms with a subform and also with a table and had no problem with it.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

ebbo1983
Registered: Mar 16 2009
Posts: 93
the problem here is my script is quite complicated in that it takes data in from an excel file using an odbc. If I were to attach it, it would not work unless you setup a similar odbc connection on your end... most people are not willing enough to do this. If you attach your file I can perhaps look at it and see where I went wrong.

Else I can describe exactly what my script is doing....which might cause ALOT of confusion:P

heres my explanation:
i have 4 main subforms

1 - carry forward subform (contains a carryforward field which is on the top of each page - will always be 0 on the first instance - the carry forward value is the same as the subtotal value on the previous page) - since its 0 on first instance i want to hide the first instance!
2 - values subform (repeating subform, contains a field pulls in values from an excel file)
3 - subtotal subform (contains a totals field which is on the bottom of each page , this field adds all the values in 2 and the carry forward value - for the current page only)
4 - total subform (has a field which adds all the values (2) and totals them across all pages, this goes at the very bottom of the entire document)

I think what I will do is a mock up version of my form and post it. will be slightly easier to understand. I think my problem here i dont know whether to place fields in the initialise, calculate or docready events etc. im pretty new to all this.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I placed the script xfa.resolveNode("table.row[0]").presence = "hidden,
in the form ready event of the first row of my dynamic table.
Then I configured the table, that it will start with 3 rows.
When I looked in the preview, the table shows only 2 rows, beacuse the instance [0] is set to hidden.

But, this whole thing is only useful as long the table is not automatically populated with data, because the instance [0] is only hidden not completely away.
So it can be, that you only can't see your first data set but is is still there and will also be included in calculations.
I will use this method only on tables, where you put in data per manually.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs