For myself I use a variable to extract the value REC1 inside a script step, then I compare the value in a condition step and finally use extract step to fill the field.
Can you please tell what the selector is of your Standard Script? And is the results.each() function meant for the detail table "detailS " or for the nested detail table detailDetails? Because in that case I suppose that you can skip one index because you do already have a index value: “results.each( function (index) {…”
@Odyn, Can you please share which selector you’re using for the shared Standard Script? Is that for example “.containerRow”? Please note that in that case always the value of the “Indocator” field of the last record of the nested detail table “detailDetails” will be applied.
But this is a completely different script. Are you able to replace a value based on a record field by making use of this script? Because this script will hide the current TR-element when the indicator is equal to “DH”.
The trick in that was to pass hidden column indicator into detail table columns as first item [0].
Later I am extract this as a text() inside my script.
A option is to add the “#detNumItemID” TD-element at the beginning of the first TR-element and use for example the following if-elseif statement:
if (indicator == "D") {
this.children()[0].remove();
} else if (indicator == "DH" {
var tdElement = this.children()[0];
tdElement.attr("colspan", "10");
this.html(tdElement);
}
Please note that in this case it’s inportant to remove the attribute “colspan” from the specific TD-element and it’s also important that the indicator field does only contains the value “D” or “DH”.
Thank You Marten, I made something similar then Yours.
Now insde my dynamic table i have record with some class.
My template script use selector “detais” class
Inside record have multiple types of columns. (Depends of record type and Indicator it will be different)
I set additional class to each element like “hideDLine” which have inside display:none
I created following script to switch record in dynamic way:
// this script will be executed for each record from recordset
results.each(function(index)
{
// get hidden indicator from column
var indicator = this.children()[0].text();
// for record type D we will display records
if(indicator == "D")
{​​
this.children().removeClass("hideDRecord");
this.css('background-color', 'lightgreen');
}
// for DH record type (Detail Header)
else if(indicator == "DH")
{
// we want to extract container location for DH record
var containerLocation = this.children()[10].text().trim();
// if container location is empty
if(containerLocation.length == 0)
{
// we will add the only space
this.children()[10].html(" ");
}
​​
this.children().removeClass("hideDHRecord");
this.css('background-color', 'lightblue');
}
// for DP record type (Detail Pricing)
else if(indicator == "DP")
{
​​
this.children().removeClass("hideDPRecord");
this.css('background-color', 'lightyellow');
}
});
So in general words it will remove class which hide record when proper record will be found with proper indicator.