Jump to content

Finding across multiple fields again


Recommended Posts

Hi,

I would like to make script to search to display all records if the following Criteria are met

Criteria1  -

Field1 = "y"

Criteria2 

Any 1 of below fields do not have a "y"

Field2

field3

field4

 

Sure its simple

Thanks

Edited by Chrism
Link to post
Share on other sites

I wouldn't call it simple, but if you restate your requirement as "find all records where Field1 = "y" except those where all the other three fields have a "y", then you could write it as:

Enter Find Mode [ ]
Set Field [ YourTable::Field1; "y" ] 
New Record/Request
Set Field [ YourTable::Field2; "y" ] 
Set Field [ YourTable::Field3; "y" ] 
Set Field [ YourTable::Field4; "y" ] 
Omit Record
Perform Find [ ]


--
Side note: it looks like you're using "y" to indicate "yes" in a status field. It is much better to use a Number field with 1 for true, 0 or empty for false.

 

Edited by comment
Link to post
Share on other sites
12 minutes ago, Chrism said:

omit records if ANY of Field2, Feild3, Filed4 have a "y"

Well, then do:

Enter Find Mode [ ]
Set Field [ YourTable::Field1; "y" ] 
New Record/Request
Set Field [ YourTable::Field2; "y" ] 
Omit Record
New Record/Request
Set Field [ YourTable::Field3; "y" ] 
Omit Record
New Record/Request
Set Field [ YourTable::Field4; "y" ] 
Omit Record
Perform Find [ ]

It could probably be made simpler if we knew what those fields do contain when they do not contain "y". For example, if they are empty, you could find them by:

Enter Find Mode [ ]
Set Field [ YourTable::Field1; "y" ] 
Set Field [ YourTable::Field2; "=" ] 
Set Field [ YourTable::Field3; "=" ] 
Set Field [ YourTable::Field4; "=" ] 
Perform Find [ ]

 

Link to post
Share on other sites

Thank you, you really know your stuff!

 

It a mixture, they are mainly blank is they do not have a "y", its legacy data that has been imported, no consistency unfortunately!

Link to post
Share on other sites
8 minutes ago, Chrism said:

no consistency unfortunately!

Perhaps you should spend a moment or two making it consistent. Otherwise you will be constantly dancing around obstacles.

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who Viewed the Topic

    1 member has viewed this topic:
    Daemon 

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.