Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Repeatable subform elements and incoming XML with missing fields?

Avatar

Level 1

I am by no means an expert but I have a condition where a form will bind to an xml repeatable element called transactions with elements under each transaction as seen below.

I'm having trouble with a situation where the including XML is missing an OPTIONAL element for one of the transctions.  While I would expect the form to show this:

7/27/2011Deposit5000
7/28/2011Check
7/29/2011Transfer1000

It's actually showing this:

7/27/2011Deposit5000
7/28/2011Check1000
7/29/2011Transfer

So it's basically bubbling up the Credit of 1000 to the 2nd repeatable element rather than leaving it blank and correctly adding it to the 3rd repeatable element.  I'm sure it's how I have the form setup or how I'm setting up the XML binding but can someone assist?  I get around this by forcing the user to always include a blank repeatable element but it's optional in the schema so it's not a good thing to force on my callers.

Thank you so much for the help!

- <Transactions>

- <Transaction>
<PostDate>2011-07-27</PostDate>
<Description>Deposit</Description>
<Credit>5000.00</Credit>

</Transaction>

- <Transaction>
<PostDate>2011-07-28</PostDate>
<Description>Check</Description>

</Transaction>

- <Transaction>

<PostDate>2011-07-29</PostDate>

<Description>Transfer</Description>

<Credit>1000.00</Credit>

</Transaction>

</Transactions>



1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi, Make sure you have have the row or repeating subform (whatever is the parent of the three fields) bound to the Transaction element, it should have a binding expression that looks like $.Transaction[*] then the three fields will have relative binding expression that look like $.PostDate and will keep them all grouped on the same row (or subform).  If the individual fields have binding expressions like $.Transaction[*].PostDate then you will get the problem you discribe. Regards. Bruce

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi, Make sure you have have the row or repeating subform (whatever is the parent of the three fields) bound to the Transaction element, it should have a binding expression that looks like $.Transaction[*] then the three fields will have relative binding expression that look like $.PostDate and will keep them all grouped on the same row (or subform).  If the individual fields have binding expressions like $.Transaction[*].PostDate then you will get the problem you discribe. Regards. Bruce

Avatar

Level 1

That was exactly the issue!  Now the question is, in what circumstances would one try to do "$.Transaction[*].PostDate" vs the binding to the parent?  I'm trying to drive some design standards and would like to know if this is just a novice mistake or a valid approach in certain conditions.

Avatar

Level 10

Hi, I haven't been able to think of one, your original binding expression might be useful in a script (with the resolveNode method) but probably not for direct binding. Regards Bruce