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

Conditional suppression using instr function

Status
Not open for further replies.

swhitt

MIS
Aug 27, 2003
28
US
I am trying to conditionally suppress text using the instr function. for example the data that I'm testing ends in either W, F, C, or L. The field that I'm testing is called APNO. In the Format Editor, I click on the X+2 box by Suppress and enter this formula to suppress the text for numbers ending in L:
InStr ({IMSV7_APUSE.APNO},'L') = 0

To suppress the text for numbers ending in W, I use the formula:
InStr ({IMSV7_APUSE.APNO},'W') = 0

and so on. What am I doing wrong. Nothing is being suppressed.

 
It may be that the field is padded with spaces.

Also if you include basic environment information you'll get better tailored results (crystal and database version).

Do you want these rows eliminated from the report entirely?

Anyway, try:

right(trim({table.field}),1) in [ "W", "F", "C", "L"]

If you want to eliminate them from the report, try using something like Report->Edit Selection Formula->Record:

right(trim({table.field}),1) in [ "W", "F", "C", "L"]

-k
 
Ooops, to eliminate from the report use:

If you want to eliminate them from the report, try using something like Report->Edit Selection Formula->Record:

NOT(right(trim({table.field}),1) in [ "W", "F", "C", "L"])

-k
 
The instring formula you were using for suppression should have been:

InStr ({IMSV7_APUSE.APNO},'L') > 0 //to suppress those ending in "L"

InStr ({IMSV7_APUSE.APNO},'W') > 0 //to suppress those ending in "W"

The instring function returns the position (number) in the string, so that if the value is NOT in the string, the result is zero; if it is present in the string, the result is some number > 0.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top