merlyn383 Posted July 15, 2004 Posted July 15, 2004 Is there a way to use the find command to find when two fields equal each other. ie. return all the records in which Quiz1Score = Quiz2Score ?
DanBrill Posted July 15, 2004 Posted July 15, 2004 There may be an easier way, but one solution that comes to mind is to create a calc field C = case (A=B;1) Then find for C=1. I don't think there is a simple way to just go into find mode and do it with A and B alone, but I'd like to be proven wrong. HTH, Dan
Lee Smith Posted July 15, 2004 Posted July 15, 2004 Exact(FieldA, FieldB) will return a 1 when true, you can then do a search for 1 and you will get what you asked. HTH Lee
MoonShadow Posted July 16, 2004 Posted July 16, 2004 A = B will work also. It will work because it is a Boolean, right JT? And true produces 1? You aren't suggesting this be entered in the Find criteria, right? I just wanted to be sure I understood this. I assume you mean Boolean because that's one of your specialties.
-Queue- Posted July 16, 2004 Posted July 16, 2004 Yes, it's a boolean test. We were talking about calculation fields to make the find easier. The find criteria in either of our 3 examples would be 1. And in Lee's and my calc, the criteria would be 0 to find records where A <> B. For Dan's it would be =.
iondesign Posted September 23, 2004 Posted September 23, 2004 OK....so how do you implement this? sorry old message but same problem. I want to attach this to a button...so using scriptmaker what do I use to find records using this calculation?? Thanks
MoonShadow Posted September 23, 2004 Posted September 23, 2004 Hi, Create a calculation (number) similarly as discussed above (A = :. Then your script ... Set Error Capture [On] Allow User Abort [Off] Perform Find [Restore ] ... in the Specify Find Requests, click New and select the calc field and type only a one (1) in the criteria. You do not need the = nor do you need to put quotes around that number. Also, if there are any prior finds listed above, remove them first. Then your script will continue as ... If [ not Get(FoundCount) ] Show Custom Dialog [ "No records found" ] you can just have an OK button and not a cancel if you wish. This would depend upon your needs. Halt Script End If ... then do whatever you wish here with the records that are found.
iondesign Posted September 23, 2004 Posted September 23, 2004 Thank you! This worked perfectly!! I have to say I really appreciate the help. riky
iondesign Posted September 23, 2004 Posted September 23, 2004 OK...i'm stuck yet again (and embarrassed at my fm ignorance!)... Now I would like to add some more conditions to this, basically to perform a find based on three fields; employee, project and date. BUT i need it to be conditional based on if they have filled the feilds (eg. may want to find employee AND date, but leave project empty)...i tried to do it myself, but keep failing again I really appreciate your time!!
MoonShadow Posted September 24, 2004 Posted September 24, 2004 No problem, iondesign. We all are FM-ignorant whether we admit it or not ... Place the three fields with conditional criteria - Employee, Project and Date on a layout for your Users to enter something into. Leave your Perform Find intact (with the calc =1). Add the following step right before the Perform Find: Enter Find Mode [ pause ] Do not specify any find requests in the Enter Find Mode [] script step; in fact, open it and make sure it's empty. Delete any pre-existing finds listed. What will happen ... FM will enter Find Mode and hesitate. Your Users will enter anything they wish into the three fields - the conditional criteria. When they hit [enter], the Perform Find script-step will add the calc = 1 to what they have entered and the Find will produce the resultant records.
iondesign Posted September 24, 2004 Posted September 24, 2004 OK...i'm a little over my head i think...i'm guessing the problem is that the calc is testing the date and i'm not 100% what fields should be where... IF you don't mind I'm attaching the file, only if you have a spare moment do you think you could check it out?? The script that's in question is "filter_records" also note it's all pretty rough looking...i'm just trying to work on the functionality!! Thanks again. riky timesheets.zip
MoonShadow Posted September 25, 2004 Posted September 25, 2004 Hi Riky, You've just about got it. A few things ... 1) You must run the Filter Records as a Perform Script at the end of your Filter Window. Otherwise, Users are placed on the Filter form in Browse mode where they would/could edit real data by accident. When they, from there, click the Show Records button, the script then enters Find Mode to allow User input. Also, right before your Halt Script, you may wish to return Users to the Timesheets Entry page and also include a Show All Records. Users left stranded on a Search page (your Filter) or a List view with no records is a bit unsettling to them. See if that makes a difference for you. I am unsure why you are using your dates in a comparison calc to isolate your records; and then again placing D2 on the layout for your Users. Since I don't know the purpose it may well be logical. If it still doesn't produce the results you require, say a bit more about those dates, okay? ... what they represent and what you are trying to accomplish with the two dates; but I think the above might do it.
Recommended Posts
This topic is 7367 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