I've created a dynamic pdf via Livecycle Designer ES4. My requirement is to add rows dynamically to a table based on the no of test's in the xml file if there are more then one test in the xml file create the row dynamically and populate the test data into the cells. For the first row, data is getting populated in the table and from the second row onwards which is created using "addInstance()" method data is getting populated in the LiveCycle tool but it is displaying an empty row in the generated pdf in the application. Please find the below code :
GenericTemplateRequest.MainForm.ABNFormEnglishPatient.ABNTestsTable::initialize - (JavaScript, client)
var testNodes=xfa.datasets.data.GenericTemplateRequest.tests.resolveNodes("test[*]").length;
var testCnt = 0;
var medicareReason;
for(var i=0;i<testNodes;i++){
var abnFlag=xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sLCPFDAFlag.value;
if(abnFlag != "N"){
var sABNFlag = xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sLCPFDAFlag.value;
if(sABNFlag == "A")
{
medicareReason = 'Test Reason 1';
}
if (sABNFlag == "B")
{
medicareReason = 'Test Reason 2';
}
if(sABNFlag == "C")
{
medicareReason = 'Test Reason 3';
}
if(testCnt == 0){
GenericTemplateRequest.MainForm.ABNFormEnglishPatient.ABNTestsTable.ABNTestsRow.Laboratory Tests.rawValue = xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestCode.value+" "+xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestDesc.value;
GenericTemplateRequest.MainForm.ABNFormEnglishPatient.ABNTestsTable.ABNTestsRow.Reason.raw Value = medicareReason;
GenericTemplateRequest.MainForm.ABNFormEnglishPatient.ABNTestsTable.ABNTestsRow.Cost.rawVa lue = xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestCost.value;
}else{
var newRow = GenericTemplateRequest.MainForm.ABNFormEnglishPatient.ABNTestsTable.ABNTestsRow.instanceM anager.addInstance(i);
newRow.LaboratoryTests.rawValue = xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestCode.value+" "+xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestDesc.value;
newRow.Reason.rawValue = medicareReason;
newRow.Cost.rawValue = xfa.datasets.data.GenericTemplateRequest.tests.nodes.item(i).sTestCost.value;
}
testCnt++;
}
}