Repeat table header if there are more details then we can fit on page

Normally that depends on the script selector. If the script selector targets rows with data-repeat=detailS.detailDetails, detailRecord will be a record in the detailS.detailDetails table. If the script selector targets rows with data-repeat=detailS, detailRecord will be a record in the detailS table.

If the script selector targets rows with data-repeat=detailS.detailDetails but you want to access a record in the detailS table, that is a bit of an unusual case - you would need to modify the script. It would be convenient if a record would have a “parentRecord” property but that is currently not the case. We do have an open ticket to improve that (internal reference: SHARED-86775).

For a script that targets rows with data-repeat=detailS.detailDetails the following should give you a record in the detailS table:

let ref = this.attr("data-record-reference") || "";
let parts = ref.split("_");
let detailRecord = record.tables[parts[0]][parts[1]];

Edit: fixed typo in the script

I have some issue with this second script, maybe I don’t really understand it. @Sander

I have a field inside my data mapper inside Service table which is “OrderType”

image

So this is Record / detailsS / OrderType this main Service Box

I need to use similar script to display Order Record for example if Order Type is not empty.

When I use this script based on class selector then I have error: “Unknown table” and undefined.

image

My html record:

    <!-- Order Record for each service-->
    <tr class="serviceOrderRow" data-repeat="detailS">
        <td class="serviceOrderCell" colspan="9" data-field="OrderType">@OrderType@</td>
    </tr>

So I want to display him based on .serviceOrderRow class with “Each matched element”

Please help how to be sure if we use right field

@Odyn please ignore my previous reply and forget that second script. I gave too much information and not all of it is relevant for you.

For that particular script selector, the OrderType field should be detailRecord.OrderType.

Thats ok @Sander, i think i understand now

I used the same script which You provided at the top but changed the data-repeat scope.

The reason why it was not showing is that OrderType field was empty.
So I handle that and if its not empty then record is shown for each service box if needed which is right.

Hello @Sander

I am continue using Your script and would like to display another detail type in case if “WorkOrder” field is not empty inside detailsDetail.

It seems like when I try this the field/variable “workOrderLine” is empty (contains no character)

let ref = this.attr("data-record-reference") || "";
let parts = ref.split("_");
let detailRecord = record;

for (let i = 0; i < parts.length - 1; i += 2) {
	detailRecord = detailRecord.tables[parts[i]][parts[i + 1]];
}

// Extended Work Order detail in case when 'WorkOrderInteractions' is not empty
var workOrderLine = detailRecord.fields.WorkOrderInteractions.trim();


if (detailRecord.fields.Indicator.trim() != 'D' && workOrderLine.length == 0) 
	//this.remove();
	this.hide();

But inside my data mapper I have some value like:

image

Do You have a moment to look inside of this?

Thanks
Adam

Sorry guys, problem solved.

Instead of using 'detailRecord ’ we have to use ‘this.record’ in this case to extract proper inner detail value.

Not sure why but working @Sander