Can you let us know please what your Text Script is targeting specifically?
As in regards to your question: An option is to expand your Text Script to a Standard Script and to apply something similar to the following JavaScript code to your Standard Script:
results.each(function (index) {
var currentPage = "",
totalPage = "",
formattedBalance = "",
result = "";
if ("page" in record.tables) {
if ("Heading" in record.tables.page[index].tables) {
currentPage = record.tables.page[index].tables.Heading[0].fields.CurrentPage;
totalPage = record.tables.page[index].tables.Heading[0].fields.TotalPage;
}
}
if (currentPage !== "" && totalPage !== "") {
if (parseInt(currentPage) == parseInt(totalPage)) {
formattedBalance = record.tables.page[index].tables.Heading[0].fields.FormattedBalance;
result = formattedBalance;
} else {
result = "CONTINUE";
}
}
results[index].html(result);
});
Note: Please note that I am only checking the first record in the detail table āHeadingā (see Heading[0] in record.tables.page[index].tables.Heading[0].fields.CurrentPage, for example) and that I assume that the value of the record fields ācurrentPageā and ātotalPageā a string containing an integer concern in the above sample of JavaScript code.