1. gary
  2. Report Editor
  3. Wednesday, October 10 2018, 08:27 AM
  4.  Subscribe via email
Hi,
How to make some footer fields shown only in last page?

I have tried put something in "print_if":
- $(Page)==$(PageTotal)
- Page==PageTotal

But still no luck. Any idea?

PS: Please open the attachment


regards,
Gary
Attachments (1)
Comment
There are no comments made yet.
Ruslan Zasukhin Accepted Answer
hi,

please notice, that Report Footer - is intended to show something ONCE at the end of a report.

Page Footer, by definition, is shown on each data page.

Seems you try something unusual, maybe JS script can solve this (in case you still want it),
it needs to experiment,
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 1
gary Accepted Answer
I mean page footer. Like invoice, if multi pages, it will be unwise to show Net Total in all pages. So I want the Net Total field in page footer (is not report footer) only shown in last page.

How to achieve that?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 2
Ruslan Zasukhin Accepted Answer
Did you try Report Footer?
Does it work for your document?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 3
Sergey Pashkov Accepted Answer
I'll check if it is possible to do with JavaScript.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 4
Ruslan Zasukhin Accepted Answer
we have to think here, another additional region Report Footer is not a solution for your task. It will shift controls of Page Footer.

So lets way for a solution with JS. Sergey think it should be possible
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 5
gary Accepted Answer
I have tried to use javascript to capture "pre_print", but still no luck. Maybe I am using wrong v8 javascript syntax?

Label17 is the footer field I want to show only in last page (but not in report footer, because I want it fixed in some location).

See the attachment.


regards,
Martin
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 6
gary Accepted Answer
var a = report.page;
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 7
Sergey Pashkov Accepted Answer
One difference is that 0/1 should be used instead false/true.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 8
Sergey Pashkov Accepted Answer
Also, report.page it is the Page object, not the number, correct is:
var index = report.page.index;
References
  1. http://valentina-db.com/docs/dokuwiki/v8/doku.php?id=valentina:products:vstudio:help:report_editor:scripts:javascript:api:report:properties#report.page
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 9
Sergey Pashkov Accepted Answer
That is not as easy as it appeared at first. report.pageCount has the current number of pages during report generation, not total.

As a workaround, you can try to use position in the source query cursor.

I placed this code in the page footer pre_place script:
report.controls.label17.print = report.cursor.position == report.cursor.recordCount ? 1 : 0;

Will it work in your case?

I think we'll review report.pageCount property behaviour. We can print the number of pages for the $(pagetotal) macro, so here it should be possible, too.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 10
gary Accepted Answer
I add these javascript to capture pre_print event:

var a = report.page.index;
var b = report.pageCount;
if (a == b) {
report.controls.labelApprovedBy.print = 1;
report.controls.labelReceivedBy.print = 1;
}
else {
report.controls.labelApprovedBy.print = 0;
report.controls.labelReceivedBy.print = 0;
}
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 11
gary Accepted Answer
It works. But I do not know whether this is a solid solution or not. Any idea?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 12
gary Accepted Answer
Attachment is the output of the receipt with 4 pages. That is what I want and achieved by using the code I showed above.
Attachments (4)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 13
gary Accepted Answer
Your suggestion:
report.controls.label17.print = report.cursor.position == report.cursor.recordCount ? 1 : 0;


That is pretty neat, and I put them into pre_print (sorry I have no idea where is 'pre_place'), but no luck, every page show now.

So is my way safe?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 14
Ruslan Zasukhin Accepted Answer
So the task is solved? Good.

well, why it can be not solid?

JS is a very powerful addition to our Reports, which we have got about year ago.
It can be used for complex logic
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 15
gary Accepted Answer
I mean I am not sure
if (report.page.Index == report.pageCount) <---- this logic is always same in all situation, mean the last page. As you have said the report.pageCount behavior might be different from what I am thinking.


Anyway, I consider this task solved. Thanks sir
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 16
Sergey Pashkov Accepted Answer
If you select the pagefooter1 object in the tree you should see 'pre_place' tab script (screenshot attached)

I'll check the pre_print script of the report now, it is executed before the report is printed - as preview, PDF, etc.
But after building, so it should be OK too.
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 17
gary Accepted Answer
Yes! Your code works perfectly in pre_place. I will choose your way, thanks.

Any website describe the different among those pre_* events? I am curious different between pre_print and pre_place.


regards,
Martin
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 18
Sergey Pashkov Accepted Answer
Yes, there’s a page for it. We’ll add more details to it to make it more clear in the nearest time.
References
  1. http://valentina-db.com/docs/dokuwiki/v8/doku.php?id=valentina:products:vstudio:help:report_editor:scripts:scripts
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 19
gary Accepted Answer
I found that when only 1 page, your way fail. Any idea?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 20
  • Page :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories