Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Binding and XML Data

Avatar

Level 4

Hi Experts,

I’m creating a table and would like to use XML data that is used in a different form to populate fields.

 

This is an example of what the table would look like.  The highlighted data is what would be populated from the XML data.  The table is static and not dynamic.

meem23_0-1604064203957.png

 

This is an example of what the xml looks like:

<dataroot>

     <Schedules>

          <ScheduleID>MO1</ ScheduleID >

          <FieldA>9.0000%</FieldA>

          <FieldB>5.0000%</FieldB>

     </Schedules>

     <Schedules>

          <ScheduleID>MO2</ ScheduleID >

          <FieldA>8.5000%</FieldA>

          <FieldB>4.5000%</FieldB>

     </Schedules>

</dataroot>

 

Can I bind the fields?

meem23_1-1604064203962.png

 

How would I go about doing this if FieldA is needed for Qtr 1 row and FieldB is for Qtr 2 row? Binding fields rather than using JavaScript code would be best, but if a script is needed, can I get some guidance in what this script would look like as I'm not a programmer and have little scripting knowledge.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

 

If your table is static then could you have two body rows.  The binding expression for MO1 in the first body row would be "$.Schedules[0].FieldA" , MO2 would be "$.Schedules[1].FieldA", then for the second row use "$.Schedules[0].FieldB" and "$.Schedules[1].FieldB".

 

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

 

If your table is static then could you have two body rows.  The binding expression for MO1 in the first body row would be "$.Schedules[0].FieldA" , MO2 would be "$.Schedules[1].FieldA", then for the second row use "$.Schedules[0].FieldB" and "$.Schedules[1].FieldB".

 

Bruce

Avatar

Level 4
This works. Thanks for your help!