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

Using "OR" is report form line

Status
Not open for further replies.

Richardkl

Technical User
Dec 8, 2001
40
US
foxpro 2.6

I use the following command line

report form c:\simple\RESET.frm for VENDOR1 <> "EDISON" OR VENDOR1 <> "CAPITOL" OR VENDOR1 <> "EDISON" PREVIEW

I get those names still showing in the report. Is there away to not get those names in a report
 
report form c:\simple\RESET.frm for VENDOR1 <> "EDISON" AND VENDOR1 <> "CAPITOL" AND VENDOR1 <> "EDISON" PREVIEW

Here is another way to say the same thing, but it will be easier to add additional words to filter:

report form c:\simple\RESET.frm for NOT ALLTRIM(VENDOR1) $ "EDISON,CAPITOL,EDISON" PREVIEW

dbMark
 
report form c:\simple\RESET.frm for VENDOR1 <> "EDISON" OR VENDOR1 <> "CAPITOL" OR VENDOR1 <> "EDISON" PREVIEW[\quote]

The problem lies in the OR operator because it will return .T. if any one of the expressions is true. If VENDOR1 is equal to "EDISON" then it's not equal to "CAPITOL" and the second part of your FOR clause will evaluate as .T. and the record will print.

Use AND like dbMark suggests.

Geoff Franklin
 
report form c:\simple\RESET.frm for VENDOR1 <> "EDISON" OR VENDOR1 <> "CAPITOL" OR VENDOR1 <> "EDISON" PREVIEW

NOTE: That above you are redundantly excluding "EDISON"

Some other possible code alternatives

ALLTRIM(Vendor1) is NOT (!) included in the following string...
Code:
  REPORT FORM c:\simple\RESET.frm ;
    FOR !(ALLTRIM(VENDOR1) $ "EDISON,CAPITOL,EDISON") ;
    PREVIEW

ALLTRIM(Vendor1) is NOT (!) in the list that follows...
Code:
  REPORT FORM c:\simple\RESET.frm ;
    FOR !INLIST(ALLTRIM(VENDOR1),"EDISON","CAPITOL","EDISON") ;
    PREVIEW

Good Luck,

JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Yes, I noticed that the first and third words were duplicates, but left them as is. But now I notice my sample would not have worked correctly, as it would have also excluded smaller words such as "ED", "SON" or "PIT". This is better, but requires that the string containing the words always begin and end with a comma, in other words, a delimiter:
Code:
REPORT FORM c:\simple\RESET.frm ;
    FOR !(","+ALLTRIM(VENDOR1)+"," $ ",EDISON,CAPITOL,EDISON,") ;
    PREVIEW
I do agree the INLIST() function is a better solution.
 
Thanks guys, the use of "for NOT ALLTRIM(VENDOR1) " was the solution to my problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top