How to display dynamic table fields inside Master Page

I have another problem here @Marten @hamelj @Erik

Inside header of document which is already inside my Master Page, i would like to display few fields from Details.

The reason why I have to do this is that Statement and Invoice have different headers. Also the formatting of header will look a little different.

Is there any idea how to do this?

Appreciate any help.
Adam

Hi @Odyn,

A “few fields from Details” as in a few fields from a single Details detail table record or as in a few fields from a number of Details detail table records?

I assume that you will have to add a placeholder to your Master Page and that you will have target this placeholder- and replace it by a Standard Script to which you can apply the following JavaScript code, for example:

[REMOVED]


For your information: Dragging and dropping a detail table record field from within the Data Model window into your Master Page will shown the following info message:

screenshot_info-message

Thank You @Marten

I just have few fields like “Date or Owner Number” which is extracted from each page (page by page) and have to display them on Master Page.

Because i have “Details” which are repeated over corresponding pages. This “Details” have few fields inside. Some of this fields I have to display on master page.

So Your script will display “fieldName” for each page of my document?

Adam

I beg you pardon, I just realized that this doesn’t work correctly. Please ignore the possible solution attached to my previous comment.

Any other way of mapping details inside master page? Or not possible.

You might consider to add the following HTML code to your Master Page and use the following Standard Script settings instead:

HTML code:

<span id="fld-example">@example@</span>

Standard Script:

Name: Example
Selector: #fld-example

var field, result = "";

if ("Details" in record.tables) {
	if (record.tables.Details.length > 0) {
		field = record.tables.Details[0].fields.fieldName;
		if (field !== "") result += field;
	}
}

results.html(result);

Hello @Marten

Your script works fine but exactly the same way like I have currently.

The value is pulled only from Detail[0] which is alway first detail page.

For example my documents have more details and I would like to print the proper values for each corresponding pages.

Page 0 ->>> Detail[0]
Page1 ->>>> Detail[1]

And as follows.

I was thinking if can do somehow Details[i] but i am not sure how to extract the current i of Details array.

Is there any way to do this?
Or I have to move everything from master page to print section?