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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

10% screen band on reports

Status
Not open for further replies.
Jul 7, 2003
95
0
0
US
I know there must be a simple method to adding a 10% screen to every other line in a simple report... but it is slipping my mind how to accomplish this.
 
You can add some transparent box of the required size after each detail line, and put there "Print when" condition, restricting it's printing to even lines only.
 
Powerprinting,

You will have to create the screen in a graphics program -- maybe Photoshop or something of that ilk. Or, find a pre-made screen that you can download from a clip art site.

Once you have the screen, add it to the detail band, then stretch it to fill the band.

Finally, set its Print When condition to select every other record. If the table or cursor that you are reporting is unindexed, with no deleted record or filtered records, you can use MOD(RECNO()) = 1 as the condition. If not, you will need a field that tells you whether this is an even or odd record.

This is just a quick overview, but I hope it will give you a start.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
I guess, I misunderstood you slightly the first time, but this doesn't change the solution much. Add a shape with no borderline and with required color/shading on each detail line, move it to the back, and restrict printing to even lines only.
 
Oh, is it actually graphics that you want there? At first, I thought you want some empty space after every other line; then I thought you want to add some 10% gray shading to every othe line. So, what is it you actually want?
 
I think I have good start with this. No, the table is indexed, but I could add a field that will populate numbers to creat the look of 1,2,3,4 etc....

In the print when expression, I put print when myfield = even ( or odd )

thats not correct I know.. what would be a correct syntac for that expression?
 
No, the table is indexed, but I could add a field that will populate numbers to creat the look of 1,2,3,4 etc....
It doesn't matter that the table is indexed and there is no need to create a field. You need to create a report variable, not a new field. Create some variable, say, cnt, with initial value =0, mark the option button to calculate count, put value to store there (you want to count only those records that would be printed), enter other options, then use that variable to check for even/odd.

what would be a correct syntac for that expression?
MOD(cnt,2)=0

or

cnt%2=0

So, which guess on what is it you want to do was correct?

Stella
 
ok.... got it working.. almost. My only problem is it is insterting two addition bands with no info in between the correct lines.. make sense?
 
powerprinting,

It's all done exactly the same way. If you need an additional colored/shaded empty band after each detail line, just add a box at the bottom of your detail band (or, if you need just to increase the distance between the lines, simply stretch the detail band itself). If you need the box after each 2nd, 5th or whatever line, just play with the print-when expression of that box.
 
Either I am very confused or havent explained well. Here is what I did.

first, I set up a variable, used your suggestion and called it cnt.

next, I inserted into the detal band two rows containing the same fields names of name, address, city... etc

the first band is shaded with screen, so far so good.

In the expression, print when, print only when expression is true... in the first detail band I put mod(cnt,2)=0

in the second band, no shade or screen, I put mod(cnt,2)=1

now what happens is the first (shaded band) prints the data.... the second band, unshaded, prints nothing.

What am I missing or am no explaining myself well enough?
Thanks for you help
 
powerprinting

First, let's clarify what is it exactly you are trying to achieve.

If I understood you correctly, you want to make a "zebra" report - odd lines are white, even lines are shaded, right?
Then what's up with two additional empty lines in between? Should they also be one white, one shaded or not? Please, explain.

Second, in any case, you don't need two identical detail rows with the same fields, you need only one. With shaded box on the background. With Print-when expression something like mod(cnt,2)=0 for the box only. So, when the variable that counts your lines is assigned an even value, the shaded box behind your fields is showing, when it's value becomes odd, it's not. That's it. If you want more than that, please explain your needs.

Stella
 
yes, Zebra is what I want.... from what you say, I am putting the varible in with the data fields and need only ONE detail line, not two. and the varible needs tied to the box... I hope I understand the correctly.. let me try that.

Again thank.
 
Getting closer!!! I removed any refrence to the varible in print when in the data detail.

The shade box in the form I added.. print when mod(cnt,2)=0

now, each box is shaded. Not zebra.. I must be missing one addition element.. but dont know what.

each line is shaded. I I put mod(cnt,2)=1, each line loses the shading.
 
I am putting the varible in with the data fields
I am not sure I understand what you mean. You don't need to print the variable, you need it only to keep track of even/odd lines.

and the varible needs tied to the box
Actually, it's the box tied to the variable.

let me try that.
Yes, try that and please let me know of the results or questions.
 
I did... I tied the varible to the BOX... not the data.

The shade box in the form I added.. print when mod(cnt,2)=0

however, each line is shaded... not every other one

In the BOX is the print when varible
 
I must be missing one addition element.. but dont know what.
I guess I know what.
Your variable is set up incorrectly. What options did you select for it and what expressions used?
 
ahhh.. you were right, I didnt select count in calculate field... seems to be fine now.. you have been patient.. thanks. Now I know how to do this...
 
So if value to store = 0 and calculate = nothing, your variable's value is always 0. MOD(0,2)=0, so your shaded box is always printed.

Why did you set calculate = 0 when I mentioned to calculate count ? Count is what you need.

As for value to store = 0, it should work in simplest cases, but in general, you might need a more complex expression. But let's keep it simple for now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top