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!

Using Suppress Report Feature in a Grid

Status
Not open for further replies.

edbytes

Programmer
Aug 29, 2001
27
0
0
US
Looking to use the suppress feature available in reports in a form grid. Search option still seems to be down so haven't tried that. Any help GREATLY appreciated.
 
Sorry, using fox for DOS terminology. It's actually the "print repeated values" option on a text box. If you double click on a text box, click "print when" the first option is "print repeated values" which works the same as the suppress option in fox for DOS. Still do alot of programming in fox for DOS.
 
I use a report to review information that I send out. However, once in a while I have to edit that info which means cancelling the report, editting and re-running the process. I'd like to be able to use the print when option a report provides on a grid in a form so I can use a grid to do the same as the report however allowing me to edit on during the process instead of restarting. I have several fields that repeat information like a name or number and would like to NOT see the repeated values, only show the value when it changes. For instance let's say you have the following:

Name order#
-------- ---------
bob 1
bob 2
bob 3
john 1
john 2
john 2
john 3

using the print when option on a report and setting it to "no" on both test boxes with in the report it would like the following:

NAME ORDER NUMBER
---------- -------------
bob 1
bob 2
bob 3
john 1
bob 2
bob 2
bob 3

The items in red would not appear on the report or grid if the "print when" option was set to "no"
I would like to use this on a grid so I don't have to run a report, I just don't know if this feature is available without running a few loops and doing in manually.


 
Edbytes,
That option Worked in VFP3-8.
In VFP9 it does not work the way it did in the past. Have not played with VFP9 enought to get it to work.

try this before the report form call
set reportbehavior 80
report form .....
set reportbehavior 90

Let me know if it works, This is just a Wild Guess.


David W. Grewe (Dave)
 
DWGrewe, I'm trying to get the "print when"->"repeated values=.f." option to work in a grid (if it's possible without a bunch of code on my part). Perhaps I wasn't clear on that above but the example above demonstrates what I want to do in a grid. Vfp8 and 9 both provide "print when"-> "repeated values = .f." options. The print when option is available by double clicking a text box on a report. In vfp8 you select the "print when" command button and select "no" in the "print repeated values" option. In vfp9 you double click the text box, select the "print when" tab and select "no" on the "print repeated values" option.
 
If I understand you correctly:

Its got nothing to do with reports. As your table is not a relational one and has multiple similar records, you only want to display the Changed Values IN A GRID.

You want to mimic the "Repeat values" = .f. in a report IN A GRID.

Right?
 
Edbytes,

Perhaps I wasn't clear on that above

That's a huge understatement.

I'm sorry to have to point this out, but, based on your first couple of posts, no-one could possibly have guessed what you were trying to do.

I think Imaginecorp has finally sussed out what you are asking. It has nothing to do with reports or "print when". You simply want the value in a grid row to be suppressed if it is the same as the value in the row above.

If that's correct, I'm sure we can suggest some solutions. But I hesitate to do so now, in case I have completely misunderstood the problem.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
My apologies to all, it's been a rough week and I "assumed" it was straight forward, and clearly, it was not.

As ImagineCorp stated, yes I would like to mimic "repeat values = .f."

Wow I made that complicated.
 
Edbytes,

OK, now that we all understand the problem, we can discuss some solutions.

One approach would be for you to add an extra field to the table or cursor that's populating the grid. Keep the existing Name field, but have a new field called, say, DisplayName, that will populate the Name column.

Write some code to loop through the table, setting the contents of DisplayName equal either to Name, or to an empty string, depending on whether it's the same as in the previous record. Something like this:

Code:
lcPrev = "@@@@@"   && impossible value
SELECT TheTable
SCAN
  IF Name <> lcPrev
    REPLACE DisplayName WITH Name
    lcPrev = Name
  ELSE
    REPLACE DisplayName WITH ""
  ENDIF
ENDSCAN

You than set DisplayName as the ControlSource of the column in which you want to suppress the repeating values.

For this to work, the table must be in Name order.

I haven't tested the above code, and can't guarantee that it is correct, but it should give you the general idea.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks to all and especially to MikeLewis for providing a workable suggestion. Unfortunately, I was hoping to take advantage of vfp's built in print when feature somehow, since I want to do this on multiple fields. Another solution I had considered would be to use logical fields an d make them true if I found repeated values, but similar to Mike's suggestion it may slow things down too much due to running this on many fields.

Thanks to all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top