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!

Complex Record Selection Formula

Status
Not open for further replies.

eao

MIS
Nov 14, 2001
104
US
I have two tables, Work Orders and Work Order Details, in the following relationship: _WORKORD_ 1:M _WORKDET_ .

Here's the pseudocode I am trying to implement:
Display all Work Orders with Work Order Detail equal to C, except those with Work Order Details equal to Y or Z.

_WORKORD_ has one field I am concerned with: _WORKORD_.SEQUENCE (Autogenerated primary key).

_WORKDET_ has only two fields that I am concerned with:
1. The foreign key linking back to [_WORKORD_] named WO# (_WORKDET_.WO)
2. Work Order Detail Name (_WORKDET_.NAME)

The Record Selection Formula I wrote is actually this:
Code:
({_WORKDET_.NAME} = "A") and not ({_WORKDET_.NAME} in ["Y", "Z"])

All this code does is omit the Details Y and Z from the report. I'm stumped.
 
Try this...

IF _WORKDET_.NAME = "A" then TRUE ELSE FALSE;

Can then use the select expert to pull on that which is true...

OR

IF _WORKDET_.NAME = "A" THEN
TRUE
ELSE IF _WORKDET_.NAME = "Y" OR _WORKDET_.NAME = "Z" THEN
FALSE Brian
 
Code:
IF _WORKDET_.NAME = "A" then TRUE ELSE FALSE;

This works fine if I am only selecting the from _WORKDET_ table, but I want to select all _WORKORD_'s that have _WORKDET_ equal to C, except those with _WORKDET_ equal to Y or Z.

Code:
For each _WORKORD_ entity,
     where ((_WORKDET_.WO = _WORKORD_.SEQUENCE) and 
          (_WORKDET_.NAME = "A")) but not where
               ((_WORKDET_.WO = _WORKORD_.SEQUENCE) and 
                    (_WORKDET_.NAME in ["Y", "Z"]))

Do I possibly need to use two formulas here? One to select all records where
Code:
(_WORKDET_.NAME = "A")
, and one to omit
Code:
(_WORKDET_.NAME in ["Y", "Z"])[code]?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top