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]];
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â
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.
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â
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.
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();