Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Bind rows in a dynamically table based on a condition

Avatar

Level 2

Hello community,

I created a table that grows dependent on the data in the XML schema.

The XML schema looks like this e.g.:

<ITEM>

<ID> 10</ID>

<FIELD1>Test1-10</FIELD1>

<FIELD2>Test2-10</FIELD2>

<FIELD3>Test3-10</FIELD3>

</ITEM>

<ITEM>

<ID> 20</ID>

<FIELD1>Test1-20</FIELD1>

<FIELD2></FIELD2>

<FIELD3>Test3-20</FIELD3>

</ITEM>

<ITEM>

<ID> 30</ID>

<FIELD1>Test1-30</FIELD1>

<FIELD2>Test2-30</FIELD2>

<FIELD3>Test3-30</FIELD3>

</ITEM>

These item positions should be printed in a table. Therefore, I bind the fields in the first growing row to itemID, field1, field2 and field3.

But now I got this results: If there is no value in Field 2 in the Item ID 20, then there is simply the next value of Item ID 30 displayed. See following example:

Item IDField 1Field 2Field 3
10Test1-10Test2-10Test3-10
20Test1-20Test2-30Test3-20
30Test1-30Test3-30

How can I make sure that the values in the fields match the item ID? Which method can be used for this? I think to set presence to hidden is the wrong way because I want to display the value in the row below...

Can you help probably Bruce BR001​?

Thanks in advance.

Best regards,

Deborah

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Deborah,

This should just work, what have you got as a binding expression for Field 2.

Maybe worth making the binding expression for the row of the table to something like, "$.ITEM[*]", so all the fields are relative to that, this would mean that Item Id will have a binding expression of "$.ID"

The binding expressions are on the Binding tab of the Object palette.

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Deborah,

This should just work, what have you got as a binding expression for Field 2.

Maybe worth making the binding expression for the row of the table to something like, "$.ITEM[*]", so all the fields are relative to that, this would mean that Item Id will have a binding expression of "$.ID"

The binding expressions are on the Binding tab of the Object palette.

Bruce

Avatar

Level 2

Hi Bruce,

thanks so much! It works now. I put as you adviced the relative binding in the row.

Deborah