1 person found this helpful
Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row.object...objects in the second row woudl be Table.Row.object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
So now to answer your questions:
xfa.resolveNode("Table.Row.Description").rawValue = "This is my new description";
Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
Hope that helps
Great, thanks for the answers. I have most of this working now
Event code - OnClick - ButtonX1
OutputTable.resolveNode("OutputRow").OutputField1 .rawValue = this.parent.DescriptionX1.rawValue
OutputTable.resolveNode("OutputRow").OutputField2 .rawValue = this.resolveNode("caption.value.#text").value
OutputTable.resolveNode("OutputRow").OutputField3 .rawValue = InputField.rawValue
InputField (value set to "TestValue")
| ButtonX1 (caption "TESTCAPTION") | ButtonX2 (caption "TESTCAPTION2") | "Description of item"
OutputTable Row 0 | Some value | Some Value | Some Value
OutputTable Row 1 | Description of item | TESTCAPTION | TestValue
Question 2 continued
The button is in one table and the result is in another table. I need to resolve the last added instance of the output table.
How do I know what the last instance that was added is? Is there anyway besides iterating through all of the values? What would I search for if I need to iterate?
The above code would always sets the second row's data.
Exactly - the xml would contain captions that would go on the buttons. I would to keep it simple but have something like
The items on the menu will change often and updating the pdf everytime is difficult. I suppose I could hard code the buttons and xml the description at the worst case? I would prefer to be able to fill the whole table as the captions may prefer to be different
I think I figured out question 2 continued
OutputTable.resolveNode("OutputRow[" + OutputTable.OutputRowRow.instanceManager.count-1 + "]").OutputField3 .rawValue = InputField.rawValue
Is there a problem with doing it that way?
Glad you figured it out ...nothing wrong with doing it that way.
Normally XML contains data and not captions so by default these xml files are bouond to the rawValue property. You can turn on dynamic binding and other properties of the object will become bindable(they appear as links) in the UI. If you click on the link for caption a wizard comes up allowing you to bind to the appropriate node in the XML.