Hi, I've been using choice subforms for some weeks, so far they worked like a charm.
Now, I need to show subforms (or not), using a difference approach, according the following (new, for me) criteria:
I got this xml:
<root>
<account>
<productType>1</productType>
<productName>Saving account</productName>
<currentBalance>111111</currentBalance>
<availableBalance>111222</availableBalance>
<savingAccountField1>Saving account field 1</savingAccountField1>
</account>
<account>
<productType>2</productType>
<productName>Loan</productName>
<currentBalance>222222</currentBalance>
<availableBalance>222333</availableBalance>
<loanField1>Loan field 1</loanField1>
<loanField2>Loan field 2</loanCorrienteField2>
</account>
</root>
(sorry I dont know how to format it in this forum)
I got also 2 subforms, one with fields and properties that belong to a Saving account, and other with fields and properties that belong to Loan's type of accounts, both subforms are inside a subform choice set.
Now, the tricky part, how can I selectively show:
- both subforms if I have product types 1 and 2 (first tag in the xml account node)
- one or the other if I have only one product type (1 or 2)
- neither if I dont have any of those product types present in the xml.
- multiple instances of the subforms if I have more than one type of the same product type.
I hope I expressed myself and the problem I have correctly.
Thanks!.
Solved! Go to Solution.
Views
Replies
Total Likes
1) Select your SubformSet and choose Edit Alternatives... from your Object palette
2) You should see your two subforms in the Edit window. Use $.account for both Bindings (assuming your root subform is named 'root'.
3) For the Expression (JavaScript), use the script: productType.value=='1' in one and productType.value=='2' in the other depending on what subform you want to show.
4) Close that Edit window by clicking OK and go to the Binding tab. Make sure Repeat Subform Set for Each Data Item is selected.
That should do it!
Kyle
Views
Replies
Total Likes
1) Select your SubformSet and choose Edit Alternatives... from your Object palette
2) You should see your two subforms in the Edit window. Use $.account for both Bindings (assuming your root subform is named 'root'.
3) For the Expression (JavaScript), use the script: productType.value=='1' in one and productType.value=='2' in the other depending on what subform you want to show.
4) Close that Edit window by clicking OK and go to the Binding tab. Make sure Repeat Subform Set for Each Data Item is selected.
That should do it!
Kyle
Views
Replies
Total Likes
Kyle, thanks, that is exactly how I did it some minutes ago just testing how that expression screen works. I didn't use Javascript though, I used FormCalc and checked against: productType == 1 or 2.
Worked perfectly, it even repeated the subforms if more nodes of items were present.
Thanks!.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies