imoree Posted March 12, 2012 Posted March 12, 2012 (edited) If you can try this, you will see what it does. I am sure what i am doing is silly. But i want to test the data with valid search terms and this is not working> please can someone help .. thanks Set Error Capture [ On ] If [ IsValid( search::search term) & not IsEmpty(search::search term) ] Show All Records Set Variable [ $searchString; Value:"==" & search::search term ] Enter Find Mode [ ] Set Field [ search::data; $searchString ] Perform Find [ ] Go to Record/Request/Page [ First ] Loop # # no records FOUND - get out # Exit Loop If [ Get(FoundCount) = 0 ] If [ Substitute( search::data; """ ; """) ≠ $searchString ] Omit Record Else Go to Record/Request/Page [ Next; Exit after last ] End If End Loop End If Edited March 13, 2012 by Lee Smith
Raybaudi Posted March 12, 2012 Posted March 12, 2012 Hi for what I can see, there is at least one error: If [ IsValid( search::search term) & not IsEmpty(search::search term) ] must be: If [ IsValid( search::search term) and not IsEmpty(search::search term) ] 1
imoree Posted March 13, 2012 Author Posted March 13, 2012 Made change. Same Behavior. Will keep trying to find issue.
LaRetta Posted March 13, 2012 Posted March 13, 2012 Hi Ian, Some possibilities: You are searching in the search table itself. Is this right? Wouldn't you want to search in a data table? You are testing for IsValid(). Why? Is it a date? You have advanced ... what happens when you run it through debugger? You have not told us where it fails - does it not find records?
imoree Posted March 13, 2012 Author Posted March 13, 2012 Hi Ian, Some possibilities: You are searching in the search table itself. Is this right? Wouldn't you want to search in a data table? You are testing for IsValid(). Why? Is it a date? You have advanced ... what happens when you run it through debugger? You have not told us where it fails - does it not find records? sorry it actually fails because it omits the "CORRECT FOUND RECORD" , in essence my $searchScript succeeds, but as it eliminates "ALL FILES THAT SOMEWHAT MATCH", it omits the actual correct set. I am attaching script so you can see. *I am sure it is simple.. search.fp7.zip
LaRetta Posted March 13, 2012 Posted March 13, 2012 Your example cannot find any matching records. ia moree is not a record in this found set and since you begin it with =, it is looking for exact match on the word 'ia' Please tell us the purpose here. Why are you searching for records and then looping the found set to see if they match. If you want an exact match why not use == to begin with? At least provide me with exact example of search criteria that 'breaks' in the way you think it breaks. And tell me the purpose. What are you searching for? BTW, this part ... Substitute( $searchString; "=" ; "" ) ≠ search::search term Since you add = to the search term to begin with, after you remove it you will always end up again with the search term ... so they will always match after you again remove the = using Substitute(). Are you meaning to test the Data instead here?
imoree Posted March 13, 2012 Author Posted March 13, 2012 LaRetta: *Slap myself in the head>> SearchTerm was not a GLOBAL field so it was always an empty search!! DOH!!! -at least thats what i got. It works well for now. I am sure i need to do more, but this will suffice for now.. thanks for at least wanting to help.
LaRetta Posted March 13, 2012 Posted March 13, 2012 No, the search was setting. Normally you would use a global but it is not at all uncommon to use data from a record to search other records (it is similar to Find Matching Records). Your search (when you had ia moree) entered into Data as: =ia moree You loaded a variable with =ia moree and set the field with the variable. Do you ever walk your scripts through debugger and watch what they do? But then again ... I still do not know your problem. You AGAIN fail to share the needed information. And you are no longer a newbie. You make things much harder than they need to be.
imoree Posted March 13, 2012 Author Posted March 13, 2012 Sorry LaRetta. i am narrow - viewed. All i see if This is not working. Here is what i have finished, but the Global Search field was 1 issue. Still it was the modifier which i learned from FilemakerHacks, this is my finished script at least for now; Set Error Capture [ On ] If [ not IsEmpty(search::search term) ] Show All Records Set Variable [ $searchString; Value:Substitute( search::search term ; """; """) ] Enter Find Mode [ ] Set Field [ search::data; $searchString ] Perform Find [ ] Go to Record/Request/Page [ First ] Loop Exit Loop If [ Get(FoundCount) = 0 ] If [ Substitute ($searchString; """ ; """ ) ≠ search::data ] Omit Record Else Go to Record/Request/Page file:///page1image6664 [ Next; Exit after last ] End If End Loop End If Set Error Capture [ Off ] Speak [ Text: Case ( Get (FoundCount) > 1 ; "Found" & Get(FoundCount) & "records" ; "Found" & Get(FoundCount) & "record" ) ] [ Wait for completion ] & yes, i do use the debugger. I am more audio learner & visual in the actual environment. explaining all the nuances was not my best strength ever. I still am not sure about TO & TOG's that is a continuing struggle for me as you can see by some of my posts. I am more into more script/ programming aspects. -i Sorry LaRetta. i am narrow - viewed. All i see if This is not working. Here is what i have finished, but the Global Search field was 1 issue. Still it was the modifier which i learned from FilemakerHacks, this is my finished script at least for now; -i Set Error Capture [ On ] If [ not IsEmpty(search::search term) ] Show All Records Set Variable [ $searchString; Value:Substitute( search::search term ; """; """) ] Enter Find Mode [ ] Set Field [ search::data; $searchString ] Perform Find [ ] Go to Record/Request/Page [ First ] Loop Exit Loop If [ Get(FoundCount) = 0 ] If [ Substitute ($searchString; """ ; """ ) ≠ search::data ] Omit Record Else Go to Record/Request/Page file:///page1image6664 [ Next; Exit after last ] End If End Loop End If Set Error Capture [ Off ] Speak [ Text: Case ( Get (FoundCount) > 1 ; "Found" & Get(FoundCount) & "records" ; "Found" & Get(FoundCount) & "record" ) ] [ Wait for completion ] & yes, i do use the debugger. I am more audio learner & visual in the actual environment. explaining all the nuances was not my best strength ever. I still am not sure about TO & TOG's that is a continuing struggle for me as you can see by some of my posts. I am more into more script/ programming aspects. I don't know why the forum does this to the code?
Lee Smith Posted March 13, 2012 Posted March 13, 2012 Because you're not using the code brackets. If you look in the text edit box above where you type your message, you will see 2 rows of editing tools. 2nd row beginning with the icon for Bold, you will see icons for several things including Link, Unlink, Image, Code, Quote - and so on. Select the data that you want to show as Code, then click on the Code Icon, or you can select the Code Icon and paste it Into the box that will appear. BTW, I went back and played with some of the 2 you had posted so you could see what I mean. Hope this helps Lee
Recommended Posts
This topic is 4707 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