Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not suppressing blank lines 4

Status
Not open for further replies.

SitesMasstec

Programmer
Sep 26, 2010
508
Brasil
Hello colleagues!

I have created a report which has 20 detail rows:

TelaItens_i01r7y.jpg


When processing the report I want to remove lines which have no data in each field, so I set the Properties, Print When tab, for each field to:
1) Print field only when data>0
2) Remove blank line
PrintWhen_doinkd.jpg


But when I process the report, the blank lines are NOT suppressed!

Am I missing anything?


Thank you,
SitesMasstec
 
Hi

Yes, Mark, I did this for all labels and fields of the Detail section of the report.

Then I don't understand why it's not working. Could you show more of your report design - not the result?

MarK
 
In addition to all the other suggestions, you need to make sure that things are lined up exactly right. For each row in the report, select all the fields and labels and choose Format | Align | Align Horizontal Centers from the menu. Then, make sure none of the lines overlap. If even one pixel from a row that has data overlaps into the line you want to blank, it won't blank.

Tamar
 

Tamar, as you advised, I have just correct the aligment for some fields. Also, for a better report presentation. I have not seen some incorrectly positioning. Thanks.

But the report hasn't considered blanked lines, yet,

Thank you,
SitesMasstec
 
Have you set "Remove line if blank" for all fields? If just one field has set this and others in the same line not, then this never will result in a removed blank line.

And again, if you design a band with so many fields that are all printing data coming from one record, you have to ask yourself who's causing the pain of needing to put so many fields on the report.
A band is printed repeatedly for each record and so you make a design where you have one line of fields only and have as many records in your report data as you need to get to whatever number of lines your report will have.

It's quite similar to not having 20x5 fields in a table to feed 20x5 textboxes on a form but have a table with 5 fields and a grid with 5 columns.

You're causing your own troubles.

Chriss
 
Chris:

I understand perfectly what you have said and I have used the way you said since FoxPro 2.0: only one row of fields in the Detail section of the report.

But the application I am working now uses a file which has in EACH RECORD 120 fields just to be used in the Detail section:

FileTempExpl_nzfkd5.jpg




Thank you,
SitesMasstec
 
To rephrase what I already have said: Select the data from your table into a cursor, or maybe an array is even easier. Then manipulate the cursor/array so that you have one record/element per line. You can even make sure that only the info that you need in your report goes into this cursor/array.

You are wasting your (and ours) time by NOT realizing that the existing data structure is a very bad design.
 
Hi,

Your report looks more like an Excel sheet and raises a lot of questions - e.o. where do the math operations come from.

Hence, one last hint: remove all labels and fields from the detail band that are NOT part of the 20 desired rows (fields 8 - 127) and put those on the page header/footer and try again.

Furthermore, if you're working a lot with VFP reports, I recommend

The Visual FoxPro Report Writer: Pushing It to the Limit and Beyond - Paperback – January 1, 2002
by Cathy Pountney (Author), Dave Aring (Editor)

hth

MarK
 
SitesMAsstec,

and I perfectly understand that this is the structure of the data, but as Tore said you have to preprocess it for the report, so that one record only has data of one line of the report. Even if you have to live with the data structure as it is, if it's not your design, you can always move data from where it is into a new cursor to drive the report. And there's no way around that if you want to get to the removed lines.

Chriss
 
It occurs to me that you might also have a constant band height for your detail section.

Right click on the detail band bar, then pick properties and on the general tab there is a constant height option.

If you were to post a sample of the data and the frx/frt files... we could look for other things...

Regards

Griff
Keep [Smile]ing

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.

There is no place like G28 X0 Y0 Z0
 

Hello colleagues!

I can imagine how you may be tired with my question, based on how tired I am in order to find the solution.

I am going to order the book Mark suggested to read, thank you.

Griff: "constant height option" in the report has been unchecked.

Below you can find the shared link for the report and a file linked to it (Data environment). This is a simplified report from the original one, but it reflects the same problem: do not remove blanked lines.

Link



Thank you,
SitesMasstec
 
I have given you the advice you need, but you seem to refuse to follow it.

Just one hint: Where your "report" has 20 rows, it should only have ONE! And each row should contain data from ONE record! So you need to convert your table, the easiest is to copy the table to a cursor, and manipulate that cursor. For an experienced VFP programmer that cursor manipulation should take a minute or two to program. And then the report will take a few milliseconds to run.
 
I wish you good luck with trying to get this report layout working in terms of "remove line if blank".

I can only encourage to experiment to find out if something does or does not work in principle.
Here's a report that mimics the minimal "design flaw" (as I would call it) to have multiple lines of the same structure in a detail band:
multilinereport_jezsel.jpg

And the data comes from this (indeed I first created the cursor to design the report with it):
Code:
Create Cursor reportcursor (line1 char(200), line2 char(200))
Insert into reportcursor values    ('report line  1',;
                                    'report line  2')
Insert into reportcursor values    ('' ,; && blank report line 3
                                    'report line  4')
Insert into reportcursor values    ('report line  5',;
                                    '')   && blank report line 6
Insert into reportcursor values    ('' ,; && blank report line 7
                                    '')   && blank report line 8
Insert into reportcursor values    ('report line  9' ,;
                                    'report line 10')
The code is intentionally formatted this way so each line of the code corresponds to one line of the report. So you see without removing blank lines the report would have a gap line between line 2 and 4 and a gap of 3 lines between line 5 and 9.

The detail band is not set to constant height, as Griff suggested (it wasn't anyway, a constant band height isn't a default).
Both fields "line1" and "line2" have been set to "remove line if blank" in the print when tab. I didn't set the fields to "float" but kept them at the default of "fix relative to top of band". The report print like this:
multilinereport2_wznl85.jpg

So, fantastic news, you could stick to your report and data design. But it's still only working if all fields have been set to "remove line if blank". If you only set this in just one of the fields of a line, this one field doesn't determine the removal of the whole line when just it is blank. VFP reports only remove lines that are really fully blank, that's only working when all fields of a line contribute to that by a) being blank and b) having the "remove line if blank" setting checked. And even if that is all set correctly, what can then still hinder it all to work is if fields are packed too tight vertically and if their top position doesn't align exactly, each diversion from that can make it count as another line of the report, again.

It remains a flaw to me to have such a design, both in report and in data, but that's now not hindering it to work technically.

Chriss
 
Hi SitesMasstec,

I had a look at your report.

You have to make sure that ALL the fields of the table you do not wish to be printed are blank, even those with letters like E, R, Kg ... - e.g. from Lor01 till Lvr01 or Lor05 till Lvr05

Furthermore you'll have to check the "Remove line if blank" and empty the box "Print only when ... " for ALL fields in the detail band on the report (I did it for the first 5).

Additionally I moved the static info (labels etc) up to the page header and the footer and modified the report to start each record on a new page.

I uploaded a zip file SitesBakery.7z with the modified table (some fields are blanked), a prg and the report files. You unzip the file run the prg, click on Print Report et voilà.

Good luck - there is much work to do.

N.B. You may however want to rethink the structure of your table - you have too many empty fields per record. But that's another topic.

hth

MarK

 
 https://files.engineering.com/getfile.aspx?folder=784cca42-bcd6-465d-80cd-7b2d0fe7a1b1&file=SitesBakery.7z
Dear SitesMastec,

In a row in your report layout, instead of placing multiple field controls, place only a single control with following expression:

lor02 + IIF(lco02>0, STR(lco02, 6), SPACE(6)) + lno02 + IIF(lqt02>0, STR(lqt02,10,3), SPACE(10)) + lun02 + IIF(lvr02>0, STR(lvr02,12,3), SPACE(12))

Check 'Remove line if blank'.

Repeat same for all your rows.

By the way, if you're not using a mono spaced font, your columns may not be aligned. In such situations, the monospace font I always like is 'Consolas'.

Rajesh

 
Dear SitesMastec,

Or, you can create a cursor like:

Code:
SELECT ;
lor01 + IIF(lco01>0, STR(lco01, 6), SPACE(6)) + lno01 + IIF(lqt01>0, STR(lqt01,10,3), SPACE(10)) + lun01 + IIF(lvr01>0, STR(lvr01,12,3), SPACE(12)) as reprow_1 ;
,lor02 + IIF(lco02>0, STR(lco02, 6), SPACE(6)) + lno02 + IIF(lqt02>0, STR(lqt02,10,3), SPACE(10)) + lun02 + IIF(lvr02>0, STR(lvr02,12,3), SPACE(12)) as reprow_2 ;
...
...
...repeat this for each row by changing 03..04...05 and so on.
...add whatever other fields you need...
...
INTO CURSOR cRepData READWRITE

Then use this cursor as data for your report. Now, your first row field control expression would be 'reprow_1', for second row, 'reprow_2' and so on. Here also, check 'Remove line if blank' for each row.

Rajesh


 
Hi,

In a report fields may be lined up horizontally or vertically or both - just think about labels for envelopes.

I admit, the layout is a little bit unusual but it works fine - just have a look at the zip file.

Sites... just has to follow my hints (see my previous post)

hth

MarK
 
 https://files.engineering.com/getfile.aspx?folder=61dc84e4-d421-4d18-a1fd-611fb8d15e25&file=SitesBakery.7z
I spent a few minutes, and wrote this simple program to convert your table into a cursor. This cursor is ideal to drive the report. You may have to add a few more fields, or you can link this cursor to the table using the common field lcodi.

For your report this means that you only use one line in the detail band. In the details band, rename all the xxx01 fields to curreport.xxx, and delete the rest.

Code:
Local lcX, lnX, loRecord

Create Cursor CurReport (;
  lcodi n(6),;
  lor c(1),;
  lco N(6),;
  lno c(40),;
  lqt N(10, 3),;
  lun c(2),;
  lvr N(12, 3))
Scatter Name m.loRecord
Select Select('tempexpl')
Use tempexpl
Scan
  m.loRecord.lcodi = lcodi  
  For m.lnX = 1 To 20
    m.lcX = Padl(m.lnX, 2, [0])
    m.loRecord.lor = Evaluate([lor] + m.lcX)
    m.loRecord.lco = Evaluate([lco] + m.lcX)
    m.loRecord.lno = Evaluate([lno] + m.lcX)
    m.loRecord.lqt = Evaluate([lqt] + m.lcX)
    m.loRecord.lun = Evaluate([lun] + m.lcX)
    m.loRecord.lvr = Evaluate([lvr] + m.lcX)
    If m.loRecord.lqt > 0
      Insert Into CurReport From Name m.loRecord
    Endif
  Endfor
Endscan
Select CurReport
Browse Normal

This code also make sure that empty fields are not copied to the cursor. IOW, no need for any "blank if empty" in the report.
 
To give you another reason for the separation of data of the report lines into separate records. If you intent to remove lines of ingredients that have a zero amount, then that's easy with a FOR clause using [tt]FOR amount>0[/tt]. But if you have fields for up to 20 ingredients in one record ou can't skip a record if it has some of those 0 amount ingredients. You could only skip a whole record if all quantitis wold be 0. It's a natural need not only driven by database normalization theory, to have a record for an ingredient. I don't even know why anybody would get the idea to design such horrible records.

So in short even if you'd not filter data as Tore did with If m.loRecord.lqt > 0, you can run the report with filtered data. It all becomes so much simpler, if rows of the report are also records of the data, and you always can prepare a report cursor, no matter how the data is structured.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top