Answered
Hi there,
I'm using Lifecycle Designer 8.0 in SAP Netweaver.
My hierarchy looks like this:
|-data
|--BodyPage (binding: none)
|----Positions (Table, binding: $record.IT_ITEM.DATA[*])
|------PositionSection (Section, repeat for each item)
|--------Line1 (Body line, binding: Normal)
|----------...
|--------Line2 (Body line, binding: Normal)
|----------TEXT (Text field, binding: $record.IT_ITEM.DATA[*].TEXT)
As you can see, one table entry consists of both lines Line1 and Line2. I want to delete Line2 if the value TEXT is not filled.
I tried the following (in event "initialize" of Line2), but unfortunately it doesn't work:
var text = xfa.resolveNode("TEXT"); var index = this.index; if (text.rawValue == null) { this.instanceManager.removeInstance(index); }
Can anybody help me with this?
Thanks in advance...
First, "xfa" is the top node of the system. using "resolveNode" at this level won't work with the given SOM path to find a node that's deep in the form hierarchy. Especially if there is more than one "TEXT" node. Please take a look at the SOM reference.
If "TEXT" is a node inside of "Line2", then there is no reason to use the "resolve" node function at all. You can simply reference it directly.
How do you know that the value of text is ever going to be null? Are you really looking for null, or are you looking for an empty string?
The initialize event may not be the right place for this code. The initailize event is called when the form is first loaded into Acrobat. Have you checked to make sure the data is valid when this event is called? Put some console.println statments in your form to find out what's happening when this code executes.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script