Skip to main content
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:43 AM UTC

Bugs, Issues and Errors: $totpage on reports

$totpage on reports

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, A Uniface Developer I am in contact with was asked from a customer to write in each page of a somehow "critical" report something like "Page Y of X", where X is the total number of pages the whole report will have at the end. He came to me asking: - is it supported from Uniface a function giving back the total number of pages a report will generate? My answer: NO, AFAIK as of today. - is there anyhow a tricky way to solve it, avoiding to answer NO to the customer? My answer: are you using occurrences/field vertical expansion in your report? Yes! The only solution I can imagine is to run the report twice with same params: the first time to a virtual device just to get the total number of pages generated the second time effectively to generate the report output but this solutions could lead to effective errors/problems: 1) With lengthy reports new occurrence could be inserted matching chosen params between first and second execution 2) Each output device should have a virtual one coupled with EXACTLY same setup (NOT an acceptable request to sysadmins!) We agreed to tell NO to the customer (BTW: it is never a simple decision!) It is very probable/possible this request was already asked before; I remember to have lightly discussed with ULab this same issue many many years ago (U6/U7 times, 20 years or more ago...). My memory is telling me: "If you do not solve an issue today it will come back to you later" Anyhow: Am I missing something? Is there an alternative way to look at this request? Gianni P.S. @ULab: wishlist is going to be reopened sooner or later?

14 replies

Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:43 AM UTC

$totpage on reports

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, A Uniface Developer I am in contact with was asked from a customer to write in each page of a somehow "critical" report something like "Page Y of X", where X is the total number of pages the whole report will have at the end. He came to me asking: - is it supported from Uniface a function giving back the total number of pages a report will generate? My answer: NO, AFAIK as of today. - is there anyhow a tricky way to solve it, avoiding to answer NO to the customer? My answer: are you using occurrences/field vertical expansion in your report? Yes! The only solution I can imagine is to run the report twice with same params: the first time to a virtual device just to get the total number of pages generated the second time effectively to generate the report output but this solutions could lead to effective errors/problems: 1) With lengthy reports new occurrence could be inserted matching chosen params between first and second execution 2) Each output device should have a virtual one coupled with EXACTLY same setup (NOT an acceptable request to sysadmins!) We agreed to tell NO to the customer (BTW: it is never a simple decision!) It is very probable/possible this request was already asked before; I remember to have lightly discussed with ULab this same issue many many years ago (U6/U7 times, 20 years or more ago...). My memory is telling me: "If you do not solve an issue today it will come back to you later" Anyhow: Am I missing something? Is there an alternative way to look at this request? Gianni P.S. @ULab: wishlist is going to be reopened sooner or later?

Hello I did exactly what Gianni wrote you need to  print to a virtual printer with exactly the same driver, otherwise the length of pages are not the same multiple run for counting number of lines with rules like :  not having a comment on 2 pages for example So I had to create for each printer, the virtual one with a null port   Dominique


Author: mpservices (mps59@orange.fr)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:43 AM UTC

$totpage on reports

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, A Uniface Developer I am in contact with was asked from a customer to write in each page of a somehow "critical" report something like "Page Y of X", where X is the total number of pages the whole report will have at the end. He came to me asking: - is it supported from Uniface a function giving back the total number of pages a report will generate? My answer: NO, AFAIK as of today. - is there anyhow a tricky way to solve it, avoiding to answer NO to the customer? My answer: are you using occurrences/field vertical expansion in your report? Yes! The only solution I can imagine is to run the report twice with same params: the first time to a virtual device just to get the total number of pages generated the second time effectively to generate the report output but this solutions could lead to effective errors/problems: 1) With lengthy reports new occurrence could be inserted matching chosen params between first and second execution 2) Each output device should have a virtual one coupled with EXACTLY same setup (NOT an acceptable request to sysadmins!) We agreed to tell NO to the customer (BTW: it is never a simple decision!) It is very probable/possible this request was already asked before; I remember to have lightly discussed with ULab this same issue many many years ago (U6/U7 times, 20 years or more ago...). My memory is telling me: "If you do not solve an issue today it will come back to you later" Anyhow: Am I missing something? Is there an alternative way to look at this request? Gianni P.S. @ULab: wishlist is going to be reopened sooner or later?

Hi Gianni, how about printing to a Postscript-File with Header-Info "Page: %%$PAGE / $$$Totalpages$$$". You can load the file and replace $$$Totalpages$$$ with the actual number of pages, save the file and convert to a pdf.   Regards Norbert


Author: Lauterbach (norbert.lauterbach@infraserv.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:43 AM UTC

$totpage on reports

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, A Uniface Developer I am in contact with was asked from a customer to write in each page of a somehow "critical" report something like "Page Y of X", where X is the total number of pages the whole report will have at the end. He came to me asking: - is it supported from Uniface a function giving back the total number of pages a report will generate? My answer: NO, AFAIK as of today. - is there anyhow a tricky way to solve it, avoiding to answer NO to the customer? My answer: are you using occurrences/field vertical expansion in your report? Yes! The only solution I can imagine is to run the report twice with same params: the first time to a virtual device just to get the total number of pages generated the second time effectively to generate the report output but this solutions could lead to effective errors/problems: 1) With lengthy reports new occurrence could be inserted matching chosen params between first and second execution 2) Each output device should have a virtual one coupled with EXACTLY same setup (NOT an acceptable request to sysadmins!) We agreed to tell NO to the customer (BTW: it is never a simple decision!) It is very probable/possible this request was already asked before; I remember to have lightly discussed with ULab this same issue many many years ago (U6/U7 times, 20 years or more ago...). My memory is telling me: "If you do not solve an issue today it will come back to you later" Anyhow: Am I missing something? Is there an alternative way to look at this request? Gianni P.S. @ULab: wishlist is going to be reopened sooner or later?

Of course I was joking yesterday, it was such a day Laugh.
historically, for me, the most applied solution is to print in the header  "page XX" and in the trailer "follow on page (nextpage) " .... 
or "end of print" on the last page.
Have a nice day, my friends.  WinkWink

Author: TheAleph (mail@gandg.it)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:43 AM UTC

$totpage on reports

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi Unifacers, A Uniface Developer I am in contact with was asked from a customer to write in each page of a somehow "critical" report something like "Page Y of X", where X is the total number of pages the whole report will have at the end. He came to me asking: - is it supported from Uniface a function giving back the total number of pages a report will generate? My answer: NO, AFAIK as of today. - is there anyhow a tricky way to solve it, avoiding to answer NO to the customer? My answer: are you using occurrences/field vertical expansion in your report? Yes! The only solution I can imagine is to run the report twice with same params: the first time to a virtual device just to get the total number of pages generated the second time effectively to generate the report output but this solutions could lead to effective errors/problems: 1) With lengthy reports new occurrence could be inserted matching chosen params between first and second execution 2) Each output device should have a virtual one coupled with EXACTLY same setup (NOT an acceptable request to sysadmins!) We agreed to tell NO to the customer (BTW: it is never a simple decision!) It is very probable/possible this request was already asked before; I remember to have lightly discussed with ULab this same issue many many years ago (U6/U7 times, 20 years or more ago...). My memory is telling me: "If you do not solve an issue today it will come back to you later" Anyhow: Am I missing something? Is there an alternative way to look at this request? Gianni P.S. @ULab: wishlist is going to be reopened sooner or later?

I went through my dusty project notes from the 1990s: instead of $totpages (Gianni mentioned that it is a pretty old open wish), we used a textfield X_NEXTPAGE in the TRAILER reading "report continues on next page" In the LeavePrintedOccurence of the main entity, we had the code: if ($next("pkfield") = "")  ; there is no next occurence any more as PKfields are not null    X_NEXTPAGE = "report completed" endif So we have on each page a status info "continues/completed" and all in one print loop. Just another way to indicate to the reader (together with the pagenumber) that he has a "complete" report, HIH, Uli


Author: ulrich-merkel (ulrichmerkel@web.de)