Livecycle designer - script for traversing a node

priyankjain15

22-07-2020

Hello,

 

I have a form (SAP) which I am designing in livecycle designer. I have the code below for one of the fields in the form. My requirement is to traverse a list of dates in a node and choose the latest one. The below code is only for test purpose. 

 

My expectation is that after the code is executed, I expect that the field should have the value from the last node traversed. In my example, there are two rows of data and I guess the field should finally have the value from the second row. This however is not happening. The field (this.rawValue) keeps the first value itself. Once this works, of course, I will refine it further for date comparison. 

 

******************************************************

Form.bdyMain.frmFreeTextBlock.performanceperiod.EndDate::initialize - (JavaScript, client)

var oDataItems = xfa.resolveNodes("Form.bdyMain.frmTableBlock_JournalEntries.frmServiceJournalEntries.tblServiceJournalEntries.frmJustForOuterTableBorder.tblSubTotal.secSubTotal.tblSubSubTotal.rowSubTotalItem[*]");

 

var enddate;

 

for ( i=0 ; i < oDataItems.length ;i++ )
{

 

var finalnode = xfa.resolveNode("Form.bdyMain.frmTableBlock_JournalEntries.frmServiceJournalEntries.tblServiceJournalEntries.frmJustForOuterTableBorder.tblSubTotal.secSubTotal.tblSubSubTotal.rowSubTotalItem[" + i + "].colDate");

 

enddate = finalnode.rawValue;

}

this.rawValue = enddate;

 

******************************************************

 

The hierarchy view of the form looks like in the attached image. 
hierarchy view.JPG

 

The second issue that i see is that the "oDataItems.length" returns "1" even when my data has two rows of data. 

 

Can someone help me understand where I might be going wrong?

 

 
 

 

Accepted Solutions (0)

Answers (0)