Possible to refer to a Text Script multi times in the designer

Hi,

I have created a small Text Script (@DeferredPhaseInAmt1@) and tried to refer to it multiple times in different position and context. But I got a error message like “Record index out of range, cannot read property fields from undefined”.

results.each(function(index) {

var field, result = “”;

field = record.tables[“PhaseIn”][index].fields[“DeferredPhaseInAmt1”];

if (field !== “”) result += field;

this.html(result);

});

I did can refer to it in one place (one time). Second time to use will cause error.

Any idea for this.

Thanks,

John

Reading your code I assume the number of text placeholders in your document exceed the rows in your detail table. Your current script iterates over the text entries and uses the index to retrieve data from the detail table. When you have more placeholders than rows it will bump into an index that does not exist.

Can you elaborate on what you try to achieve?

Erik