×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Reports. Can Summary Band be made optional at runtime?

Reports. Can Summary Band be made optional at runtime?

Reports. Can Summary Band be made optional at runtime?

(OP)
I have a report where the customer would like a summary page - detailing a variable number of records (probably no more than 5/10 or so) but only if there are any records to show.

I can make the band, and make the contents visible only if there are details to show, but I get a blank page if there are none - not good because that is the same cost to them as a single (colour) photocopy and the customer would prefer not to waste paper.

I could make 2 reports, one with and one without the summary band, I could make a single report (which is what I have done for now) by joining two together (one which is just the summary band) at run-time using the NOPAGEEJECT option when there are details for the summary

I suppose I could even shove the .frx out to disk locally and hack it to remove the summary band at runtime...

But I just wondered if I was missing a trick, is there a way to programmatically make the summary band optional at runtime?

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Griff, I don't know of any trick that you might be missing. But I have to say that, if I had this requirement, I would almost certainly do what you are currently doing. I would make the summary into a separate report and decide at run time whether or not to run it (usinng NOPAGEEJECT for the main report if appropriate).

There may well be a more elegant approach. It would be interesting to see what other ideas people have.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
It does have the '1 to many' advantage - over using a true summary band.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

There's a SUMMARY keyword in the REPORT FORM command to suppress the printing of Detail Band lines and only print the Summary, but there doesn't seem to be an equivalent to do the opposite (only print the Detail Band lines and suppress the printing of the Summary Band).

So about the only way I would know to handle it (which you already suggested) would be to build your report with the Summary Band included. Then, if you want to suppress the printing of the Summary Band at runtime, make a temporary copy of the FRX on disk, open it as a table, and programmatically remove the Summary Band and any objects (labels, fields, shapes, etc.) contained therein prior to printing. After printing, you could delete the temporary copy of the FRX.

RE: Reports. Can Summary Band be made optional at runtime?

the .frx is really a .dbf so you could do something like

use fred.frx
select fred into cursor tmpfrx readwrite
&& by comparing 2 .frxs with and without summary i came up with this... but untested and no guarantees.
DELETE FOR objtype = 9 AND objcode =8
DELETE FOR objtype=7 AND objcode=4
use
report form tmpfrx


or

you might simply have 2 versions of the report in your program. one with and one without a summary ?

hth

nigel

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
Thank you Nigel

That was exactly what I was thinking when suggested I could 'even shove the .frx out to disk locally and hack it to remove the summary band at runtime...'

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Although I'm sure Nigel's solution would work, I'd personally be reluctant to use it. I'd be slightly nervous of any solution that depends on a knowledge of internal file structures. Of course, there is zero probability that Microsoft will ever change the structure, but I nevertheless have a built-in reluctance to rely on that fact. In general, I'd rather use doucmented features of the language where possible.

This is just my personal opinion of course. But it seems to me that the other solution - of creating two reports and chaining them with NOPAGEEJECT - would be simpler, more reliable and easier to maintain (in that other programmers looking at your code would be more likely to understand it).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
Thanks Mike

I don't see much harm in using the hack solution, it can be documented and there is very little chance that VFP20 is on the horizon so it will probably work for the foreseeable.

I am awaiting feedback on the combined reports approach, it's been in place most of a week - but not used much yet.

One major surprise for me was how easy it was to use with XFRX, you just run each bit before the .Finalise() bingo. This mean my existing code was easy to change and, crucially, my feature which copies the output to the clipboard for pasting into e-mails works straight out of the box.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Griff, I stress that my comments on not hacking the FRX were based on my personal views. Other people will take the opposite view, and that's fine. In fact, I have occasionally done FRX-hacking in my own applications, but only when I couldn't see an alternative solution.

It's interesting that you mentioned XFRX. I'd forgotten about the .Finalise() method. It's certainly an elegant feature.

Right now, I've got a requirement to generate a long report, and then to save each page of the report as a separate PDF with a filename that includes a member ID, and then to email each page to the corresponding member - all without human intervention. I'm sure XFRX will be a great help with this.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
Err... Mike you do know it's GDPR day...

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Quote:

Mike you do know it's GDPR day..

Do I know? I'll say. It's engraved in my consciousness. And probably that of many other people on Tek Tips as well.

But what's that got to do with hacking a report file?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
You are skating on thin ice... not really, just having fun

Quote (Mike)


and then to email each page to the corresponding member - all without human intervention.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Don't worry, Griff. I'm covered every which way to Sunday. Explicit consent. Legitimate interest. Rigid data security. Notification of data breaches. All taken care of. I've even put 4% of my company's global turnover in a special account just in case.

(Only kidding abut the 4%.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
I even believed the last bit.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

The major German newscast "Tagesschau" just reported fines can be 20 Million EUR or 4% of the global turnover, stating the 4% is for big companies. That makes it seem 20 Million EUR is the minimum. I think it's the other way <round, isn't it?

I don't yet collect any customer data online, but of course, I got a ton of emails, and most of them just point to their new privacy policies without asking you to confirm or accept them, I assume all those sites already complied to current laws anyway.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Reports. Can Summary Band be made optional at runtime?

Olaf, the reason those emails don't ask you to confirm or reject the new privacy policies is that the firms in question have an underlying business reason to keep your data. They couldn't operate their businesses otherwise. So there's no question of your having the opportunity to opt in or opt out. By contrast, a firm that collects your data for marketing purposes must obtain your explicit consent. It is those firms that require you to update your mailing preferences.

For most people, this is all good news of course. It provides a very easy way of getting off all those mailing lists that you don't remember subscribing to.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

Well, even those companies needing your consent and opt in, could already have asked for that long time ago, so they wouldn't need to now. In Germany the idea of opt-in vs opt-out was law for longer, already, for example. So no need to reask for that. Perhaps only to conform to certain new norms.

In contrast I got a form asking for my information from kickstarter, just my mail address and name, nothing critically like banking data. I thought that was a bit overdone.

I'm not that deep in that topic, as I have no work reference in the public web anyway, rather company internal applications. Yet, I indeed also got some things I had long forgotten about. Nothing really bad so far. I just read IT news about what you would have expected to surf that wave - sam sites asking you for credentials and other sensitive data.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Reports. Can Summary Band be made optional at runtime?

Griff,
One other solution is to not use the report writer. This requires a lot more time in investment to recreate the report, but it can be done.
A very long time ago (We're talking more than 25 years ago now) when I was starting out in Fox 2.0, I wrote a report using HPGL direct to the printer (of course that means you are stuck with an HP printer), but it would print first to file, figure out how many lines it was, and then add white space into the report to make everything appear "balanced" on the page. (This was for a resume builder that I wrote for a University placement office, and that's the way they wanted it).

So the moral of the story here is... you don't have to use the VFP report writer, when it comes to doing something very custom, it can be done in code instead.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Reports. Can Summary Band be made optional at runtime?

Scott, I agree that there are alternative ways of producing reports, other than the VFP report writer. But talking directly to the printer via HPGL seems a very retrograde step. You identified one of the reasons for that yourself: being tied into a particular brand of hardware. In addition, you lose the benefits of a WYSIWYG design tool, there is no on-screen preview, and it is very difficult to fit text to a given space if you using a proportional font (which you almost certainly will want to do). Not to mention having to write a lot of code.

If we are considering alternatives to the VFP report writer, a better option might be Automation and Microsoft Word. You would still have to write a lot of code, and you still don't have the WYSIWYG design surface (but you do have the ability to view the report on the screen from within Word). But you do get all the flexibility and formatting options that Word gives you.

Another option would be to consider a third-party reporting tool. Crystal Reports can easily handle the situation that Griff is facing, and could probably solve many of the other reporting problems that people discuss in this forum (such as multiple detail bands) - albeit at the cost of purchasing the product and learning how to use it.

However, for the particular problem we are discussing here, I still think that chaining two reports together and using NOPAGEEJECT is the most satisfactory solution.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
I loathe Crystal reports, albeit not had to touch it in a decade or more, just did not like it.
Bit like c# - some things just don't work in my 'clipper wired' brain.

Now writing in HP/PCL is not a problem, I do that everyday (almost), I have an aged Clipper (now Alaska xBase) app which generates all it's reports by writing HP/PCL.
Interestingly most commercial printers still have that at their hearts, so it turns out to be fairly portable - I use a bit of middleware called PageView to preview
all the reports and that works well.

With that approach (HP/PCL) you have complete and utter - to the pixel - control of your reporting, but by gum you need to have a mountain of resource to maintain it.


Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Reports. Can Summary Band be made optional at runtime?

Hi Mike and Griff,
Mike, I do agree with you, but in the case of what I needed the report to do, it was really the only option (writing it in code). I forgot about PCL and how useful it is too, and as you say Griff, printers do still have it at their hearts.
My 2 cents on this was just to show there are more options. Some are better than others for sure, but it is an option. I actually liked writing in the HP/PCL and to your point Mike about WYSIWYG, it was back in the DOS days, so we didn't have that benefit anyway. :)

Just an alternative, in the event someone was looking for more options.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Reports. Can Summary Band be made optional at runtime?

Point taken, Scott. In fact, back in DOS days I also used to write directly to the printer, although it was just as likely to be in the Epson control language (ESC/P) as in HP's. Up to a point, you could make the code portable between printers by storing the control codes in variables and inserting those into the lines of text. You also had to deal with page headers and footers, page numbering, and so on. But it was certainly do-able.

I think there was also a rudimentary report design tool in some versions of FoxPro for DOS, but I don't recall ever using it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

Mike,

The RW was introduced with FoxPro 1.0. It was ported from Foxbase/Mac. (And it remained relatively unchanged until the reportlistener was added.)

Prior to that, in Foxbase, the report writer was basically the dBase report writer. They even replicated one of the bugs that would lock up your system if a header expression got complex enough.

We've always had a report writer.

Dan

RE: Reports. Can Summary Band be made optional at runtime?

I remember it and used it in FPD2.x for some things. My occasion in that case was there was no way to add white space to a page between sections without knowing what the output would be first. So it would get generated to file, check the number of lines, then add white space (blank lines) between sections so that they were all balanced across the page (single page output). It kept those with a lesser experience from appearing to just have a 1/2 page resume...
It was interesting, and I've never had a need for it since...
But the report writer couldn't do it.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Reports. Can Summary Band be made optional at runtime?

You could stick in a UDF() as the report expression and have it return as many CRLF as you need, mark it stretch with overflow. Done it many times back in the day. Things were easier when it was all character output. bigsmile

RE: Reports. Can Summary Band be made optional at runtime?

Hi all

The structure of the frx has been officially documented for some time. Hacking it to remove the summary is a reasonable way to go. I will say that using Word automation is a great way to go. I had a requirement to assemble a legal contract. We tried Crystal and it could not do it, even with their tech support. I used a Word doc. Into that doc I added placeholders. I had a tiny VFP exe scan a table and search and replace the placeholders with each record's contents. This included optional paragraphs with embedded placeholders. I cannot remember exactly but I think that's why we could not use Word's mailmerge.

Word could be extended into a powerful report writer.

Mike Yearwood - Former FoxPro MVP

RE: Reports. Can Summary Band be made optional at runtime?

Dan,
Interesting, but how do you know how long it is unless it's been generated first... so that was the issue I had. I needed to know how big it was going to be (edit boxes had a max length, but some would be empty, some might have only 1 short sentence). So we had to generate the text file first, determine the number of lines, then shove white space (as a UDF) in between the paragraphs to balance the page as a whole. It was a fun challenge that I've not encountered since, nor seen anyone else do. (Not that it might not exist). My whole point was that sometimes the report writer can't meet the requirement, and then getting creative, writing to HP/PCL is not that bad an alternative.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."hammer

RE: Reports. Can Summary Band be made optional at runtime?

Quote (I can make the band, and make the contents visible only if there are details to show, but I get a blank page if there are none)


Even if you set, for all contents in summary band, the properties "Print when" -> "Remove line if blank" to "check"?
Dear Griff, I am only a newby regards to you so I ask you to not mind, but may be...

All the best,
Eugen

RE: Reports. Can Summary Band be made optional at runtime?

Griff,

This has been an interesting thread, with some useful digressions (not least on GDPR). But I was wondering if you had decided how to solve the original problem?

The reason I ask is that I have been reading up on the Mind’s Eye Reporting Engine. I noticed that it has the ability to add multiple reports to a single report job. That might work for you, as it would let you have a main report and a separate summary report. Unlike with VFP's NOPAGEEJECT, it would let you preview the combined report as a single entity. Also unlike in VFP, the different reports can have different orientations (probably not so useful in your case). You can also send the combined report to a PDF.

These features probably won't justify the purchase price in this case, but I thought I'd mention the possibility in case you are still looking for a solution, and also for the benefit of anyone who might be interested.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Reports. Can Summary Band be made optional at runtime?

(OP)
Hi Mike

Well, I have implemented the two report and NOPAGEEJECT option, it is in production and I await the user actually using it - I have a new rep at the client's office and he seems to be having a little trouble with the idea of end user testing/feedback, in that he will now probably wait three months for it to be mega urgent and then tell me I have left a comma or full stop off the print out.

That and I can't invoice until he says it's good...

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close