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

If in record selection

Status
Not open for further replies.

ShortyA

MIS
Feb 20, 2002
363
CH
I am trying to write a record selection formula where as follows:

if field1 in ['a','b','c'] and field2='def'
and
(if field 1 ='a' and

((field 3='ats') or (field3 startswith 'b')) then keep else drop record

Sounds fairly simple but I am struggling to keep the records. Does anyone have any advice on how this can be achieved?
Thanks.
 
If I understand that correctly, then this might work:

{Table.Field2} = 'def'
and
(({Table.Field1} in ['b','c']) or
({Table.Field1} = 'a' and ({Table.Field3} = 'ats' or {Table.Field3} StartsWith 'b')))

-dave
 
Try:

(
(
field1 = 'a' and
(field3 = 'ats' or
field3 startswith 'b')
) or
field1 in ['b','c']
) and
field2='def'

-LB
 
The solutions given should work, but when tests get complex, I normally 'hive them off' as distinct formula fields. I.e. create @Field4
field 3='ats' or field3 startswith 'b'

Then the main test would be and @Field4

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Hi there,
thanks for all your input - it opened up my mind to a more appropriate approach. Thanks also to Madawc for the idea of hiving the selection off. The only downside to this in some of our reports is that we have millions of records being read and the more that can be passed to the server the better. From my minimal understanding of using formulas in record selection I thought they would make the records be read before doing the selection. Do tell me I am wrong...please!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top