OL Learn

Access to dynamic table inner fields using template script


I have some detail tables inside my data mapper and template.

For example I have ServiceDetails and inside this ServiceDetail I have other Detail.

I would like to access Detail fields from templaye script to perform some acction.

He always return last value or first, value, I dont know which index pass into this script to work for current detail record. Please help

var field, result = "";

var asterisks = “”;

var serviceDetail = record.tables.detailS;
var innerDetail = serviceDetail[0].tables.detailDetails;

var tax = innerDetail[0].fields.Tax;
logger.info("tax " + tax);

var noChargePerContract = innerDetail[0].fields.NoChargePerContract;
logger.info("noChargePerContract " + noChargePerContract);

if(noChargePerContract.toUpperCase() == “Y” || tax < 0)
asterisks = “**”;
asterisks = “*”;


Please help


Where you put this script ?

It was in template, bit I changed conception and move it to data mapper.

Now I have other problem, would like to change

based on “Indicator” field from my inner detail table.

We prepared script but its not working as expected:

var field, result = "";

var serviceLen = record.tables.detailS.length;

for (var i=0; i< serviceLen; i++ ) 
	var detaillen = record.tables.detailS[i].tables.detailDetails.length;
	for (var j=0; j< detaillen; j++ ) 
		var indicator = record.tables.detailS[i].tables.detailDetails[j].fields.Indicator;
		if(indicator == "D") 
			logger.info("indicator" + indicator);
			//query('.containerRow').css("display", "none");
			//query('.detailRow').css("display", "table-col");
			query('.detailRow').css("color", "green");
		else if(indicator == "DH") 
			logger.info("indicator" + indicator);
			//query('.detailRow').css("display", "none");
			//query('.containerRow').css("display", "table-col");
			query('.containerRow').css("color", "red");




Any ideas how to do this?