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

Supressing many details 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I'm modifying a report in which the client would like the details supressed if certain values are encountered. There could potentially be anywhere from approx 25 - 200 (or more) different criteria in which should be supressed (the values are actually item numbers).

I'm assuming I would place something in the detail supression formula in the section expert. My question is what would be the best way to handle this? Do I create many if else statements? Can I place the criteria in a single string and search through it? Should I use a specific formula? Is the a more efficient way of handling this?

If someone could provide me with more information and an example, it would be greatly appreciated.

If at first you don't succeed, then sky diving wasn't meant for you!
 
It is quite possible that there is more than one solution. In my own experience a number of times it comes down to effiency (compact code) vs. readability. Without knowing the specifics of the conditions, it is hard to say.

FYI: 200+ criteria is going to be difficult at best.
 
Thanks for the quick reply however I don't understand how that helps me. I'm sure that are several ways to approach this which is why I am asking for help. The client has a lot of data (warehouse supplier) and I'm not concerned about speed, only performance.

Even an example with A, B, C, D, E, F would be helpful.

If at first you don't succeed, then sky diving wasn't meant for you!
 
If you are checking against one field. I would use an 'IN' statement (i.e., {somefield} in [1,3,4,6], results in a true and you want the details suppressed).

You can accomplish the same thing with a series of IF statements, but that can get hard to read (and maintain).

If there are multiple field combinations (i.e one field equal to a value(s) and another field equal to a value(s)), then you would probably have to use an IF statement (but they may include 'IN' statements).

There is also the 'Select...Case' statement, but that one can get bit difficult to maintain with the number of criteria you have.

Unfortunately without knowing the specifics, it is hard to know what would be best.
 
Since I haven't received any feedback yet, would something like this work?
Code:
Formula: Omit Items
Shared StringVar OmitNum;
OmitNum := "A, B, C, D, E, F";
OmitNum := OmitNum & "G, H, I, J, K, L";
OmitNum := OmitNum & "M, N, O, P, Q, R";
...

In supression formula:
Shared StringVar OmitNum;
Instr(1, DB.ItemNum, OmitNum)>0;

If at first you don't succeed, then sky diving wasn't meant for you!
 
Thanks Kray. I guess my instr would be similar to your IN function. What do you think or would IN be better?

If at first you don't succeed, then sky diving wasn't meant for you!
 
I think your solution would work and it looks pretty clean. Anybody else want to check this formula?
 
Thanks Kray. I wasn't sure if I was on the right track. I will continue as is but I'm still open to other options and suggestions.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top