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.

Get Data from specific Page

Avatar

Level 2

Hi,

I have a Form that roughly Looks like this:

HIERACHY.PNG

For Explanation:

i have two Masterpages "FIRSTPAGE" and "NEXTPAGE" with FIRSTPAGE having two Content Areas. Subform "HEADER_INFO" is displayed in "CA_HEADER_FIRSTPAGE". Subform "MAIN_AREA" is displayed in "CA_FIRSTPAGE". The table "FLOATING_TABLE" can grow dynamically depending on the data. If it grows too big, it expends into Masterpage "NEXTPAGE" Content area "CA_NEXTPAGE".

For the data, i get Infos on working Hours for several employees. The form than can look something like this:

  • Page1: Data of Employee 123 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 123
  • Page2: Data of Employee 123 (Masterpage: NEXTPAGE)
  • Page3: Data of Employee 456 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 456
  • Page4: Data of Employee 456 (Masterpage: NEXTPAGE)
  • Page5: Data of Employee 456 (Masterpage: NEXTPAGE)
  • Page6: Data of Employee 789 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 789
  • Page7: Data of Employee 789 (Masterpage: NEXTPAGE)

What i want to achieve is that in Textfield PERSNR_NEXTPAGE of NEXTPAGE the value of Textfield PERSNR of corresponding FIRSTPAGE is displayed. I cannot think of a solution here. When i just script in PERSNR_NEXTPAGE like " this.rawValue = this.parent.parent.parent.BODYPAGE.HEADER_INFO.PERSNR.rawValue; "

i get following result:

  • Page1: Data of Employee 123 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 123
  • Page2: Data of Employee 123 (Masterpage: NEXTPAGE)
    • Textfield PERSNR_NEXTPAGE = 789
  • Page3: Data of Employee 456 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 456
  • Page4: Data of Employee 456 (Masterpage: NEXTPAGE)
    • Textfield PERSNR_NEXTPAGE = 789
  • Page5: Data of Employee 456 (Masterpage: NEXTPAGE)
    • Textfield PERSNR_NEXTPAGE = 789
  • Page6: Data of Employee 789 (Masterpage: FIRSTPAGE)
    • Textfield PERSNR = 789
  • Page7: Data of Employee 789 (Masterpage: NEXTPAGE)
    • Textfield PERSNR_NEXTPAGE = 789

So as you can see there is the wrong PERSNR displayed on NEXTPAGE. What i think i Need to do is address the specific page i want to get the data from like

" this.rawValue = xfa.resolveNode("#page[ x ].HEADER_INFO.PERSNR").rawValue; " but i do not know how to do this properly.

Can anyone help me please?

Regards,

Dennis

1 Reply

Avatar

Level 10

Hi Dennis,

You will have to use the layout methods to work out which page you are on and to work out which page the appropriate PERSNR field is on.

You will also have to do this in the ready:layout event, so there could be a performance hit.

Anyway, this JavaScript code in the ready:layout event of the PERSNR_NEXTPAGE should do what you are after;

var persnr;

all:for (var i = xfa.layout.absPage(this); i >= 0; i--) { // work backwards from the current page

  var fields = xfa.layout.pageContent(i, "field"); // get all fields on the page

  for (var j = 0; j < fields.length; j++) {

    if (fields.item(j).name == "PERSNR") { // look for PERSNR field

      persnr = fields.item(j).rawValue; // if found remember value, otherwise go back another page

      break all;

    }

  }

}

this.rawValue = persnr;

Regards

Bruce