VICH Posted August 9, 2005 Posted August 9, 2005 i initially posted a faulty script of mine here: faulyt script all the help i got before took me through extra steps and having to make new fields, which wasn't what i was looking for so i sat down racked my brain and found my own answer: a script to do a "search" for two or more possible values in a single field: go to record/request/page [first] loop if [table::feild = X xor table::field = Y] go to record/request/page [next;exit after last] else omit record go to record/request/page [first] end if end loop thats it what do you guys think?
VICH Posted August 9, 2005 Author Posted August 9, 2005 (edited) now how come the script worked in my practice data base but as soon as i put it in the one i'm working on it stops working....nothing like a good foot in your mouth to haly progress for the day *edit* heh over reacted a simple misplaced underscore Edited August 9, 2005 by Guest
sbg2 Posted August 9, 2005 Posted August 9, 2005 thats it what do you guys think? Whats wrong with:? Enter Find Mode Set Field[table::field; X] New Record/Request Set Field[table::field; Y] Perform Find
SlimJim Posted August 9, 2005 Posted August 9, 2005 A record in which the field contains both X and Y would be found by the two find requests method but not by the xor method
sbg2 Posted August 9, 2005 Posted August 9, 2005 Maybe I misundertstood the inital post. If I had a Table with a field named Fruit. Record 1 Fruit = Apple Record 2 Fruit = Apple ¶ Orange Record 3 Fruit = Orange The original poster is looking for a way to find records 1 & 3 but not record 2? In which case: Enter Find Mode Set Field[table::field; "==" & X] New Record/Request Set Field[table::field; "==" & Y] Perform Find
comment Posted August 9, 2005 Posted August 9, 2005 SlimJim refered to a case where a text field may CONTAIN "apple" or "orange" or both. Which is easily solved by: Enter Find Mode Set Field [ table::text ; "apple" ] New Record/Request Set Field [ table::text ; "orange" ] New Record/Request Set Field [ table::text ; "apple orange" ] Omit Record Perform Find
SlimJim Posted August 10, 2005 Posted August 10, 2005 I did some minimal testing on this with, to me at any rate, a surprising result. Suppose we have six records with the following contents in a text field Apple Apple Orange Apple Pear Pear Orange Apple Orange The script method choses records 1,5 and 6, which I thought was surprising. The "xor" seems to apply an exact match in the Apple, Orange and if you replace it with an "or" it produces the same result - records 1,5 and 6. If you replace it with "and" you get no results (and an endless loop). Similarly if you replace it with "and not" you just get the two records with Apple. The finds behave pretty much as expected. The first sbg2 find finds all the records The second sbg2 find finds records 1,5 and 6 The Comment find finds records 1, 3 ,4 ,5, 6. Conclusion. It would appear that If(field="Apple") only returns true if field exactly equals "Apple" whereas the find field = "Apple" returns true if Apple is contained in the field. (I guess the find is on the index of the field)
comment Posted August 10, 2005 Posted August 10, 2005 A default find finds WORDS that start with specific characters. There is no "=" in a default find.
sbg2 Posted August 10, 2005 Posted August 10, 2005 New Record/Request Set Field [ table::text ; "apple orange" ] Omit Record Perform Find Huh? I completely missed the Omit Record step when reading your reply. Never realized this worked to constrain a found set, glad you posted that.
VICH Posted August 11, 2005 Author Posted August 11, 2005 you guys all kinda missed the point in one field you could have values a,b,c,x,y,z but i only wanted to find records that in that field had x or y
comment Posted August 11, 2005 Posted August 11, 2005 In your original post you used the xor operator. Which led us to believe you wanted to find records that in that field had x or y - but not both. That is what my find does. If you want to find records that in that field have either x or y, including both, use sbg2's method.
Recommended Posts
This topic is 7046 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now