surwoop Posted February 14, 2002 Posted February 14, 2002 I am using a token to build part of a find request. The token value is a field in my DB. The problem is that the field may have more than one word in it, when it does the words in the field are split into different find requests. I have tried using RAW & URL encoding with no luck. Any ideas?
Garry Claridge Posted February 14, 2002 Posted February 14, 2002 Are you using quotes around the value? E.G: <input type="text name="myfield" value="[FMP-CurrentToken]"> Good Luck. Garry [ February 13, 2002, 07:32 PM: Message edited by: Garry Claridge ]
Garry Claridge Posted February 14, 2002 Posted February 14, 2002 I've just performed a test with [FMP-CurrentToken, url]. This works fine by replacing spaces with %20. However, the "CDML Reference" database shows the tag as: [FMP-CurrentToken: url] The : should be a , Hope this helps. Garry
Keith M. Davie Posted February 14, 2002 Posted February 14, 2002 http://www.filemaker.com/support/index.html Search and read: Article Number: 104829, and Article Number: 105687
surwoop Posted February 14, 2002 Author Posted February 14, 2002 Thanks for the quick replies. Still not having any luck, here's the link i'm using and an explanation of what FM is doing. FMPro?-DB=myDB&-Lay=Web&FieldOne=[FMP-CurrentToken:2,url]MyValueOne&FieldTwo=MyValueTwo&-Format=format.html&-Max=All&-LOP=or&-Find This is what FM is doing... FM is creating more than two find requests. The first request places the first word in token.2 into FieldOne. The second request places the second word from token.2 & MyValueOne into FieldOne. The third request places MyValueTwo into FieldTwo. What (I think) FM should be doing FM should be creating only two find requests The first request should be all the data in Token.2 & MyValueOne into FieldOne. The second request should be the same as the third request obove. This example assumes that the value of token.2 has two words in it.
Garry Claridge Posted February 14, 2002 Posted February 14, 2002 This html/cdml is working for me: <a href="http://localhost:1154/FMPro?-db=combotest.fp5&-lay=web&-format=hworld.html&tryme===&tryme=[FMP-CurrentToken:2, url]&-find">Find Rec</a> It's format page is called by this url: http://localhost:1154/FMPro?-db=combotest.fp5&-lay=web&-format=hworl d.html&-token.2=hello%20world&-findany All the best. Garry [ February 13, 2002, 09:39 PM: Message edited by: Garry Claridge ]
surwoop Posted February 14, 2002 Author Posted February 14, 2002 Thanks for the suggestions howerver... I am not sure you understand my problem. I am trying to perform a search that finds records with 'this data' from one field or 'some other data' from a different field. I don't need to perform a 'field content match' search. The problem only happens when using the -LOP=or, using -LOP=and (the default if a LOP is not specified) doesn't 'split' my token, but it doesn't perform the find that I need. I hope this is clear & i'm not missing something, i'm still learning this cdml stuff.
Garry Claridge Posted February 14, 2002 Posted February 14, 2002 So it is only when the "-lop" is included. Hmm, I'll have a fiddle later on and see what I come up with. All the best. Garry
Keith M. Davie Posted February 14, 2002 Posted February 14, 2002 I think you are the one who does not understand. That is why I gave you a valuable reference. I spent six weeks finding that reference. Once I found it, it changed the way I handle things. I NEVER use a -lop or -op in a link or form action. I never have any problems. You are are the one struggling. You are the one with the problem.
Anatoli Posted February 15, 2002 Posted February 15, 2002 I am using operators a lot. Never had a single problem. People sometimes mix logic with operators and then operators are for nothing.
surwoop Posted February 15, 2002 Author Posted February 15, 2002 Nice post Keith... very helpful, I read those articles again & fail to see what they have to do with my problem, the articles refer to performing exact content match when performing an -LOP=and search. Do you understand the difference between a 'and' & 'or' search? Anatoli & Garry Thanks for the replies, my search works fine as long as the value in my token is one word, so it isn't a mixed logic problem. I'm beginning to think that I will have to get rid of any spaces in the field that creates the token value. Thanks for your help. surwoop
Keith M. Davie Posted February 15, 2002 Posted February 15, 2002 "Do you understand the difference between a 'and' & 'or' search?" Why yes, as a matter of fact I do. That is why I also would not use an "or" search. Sometimes what you want to do, what you think should occur, well, it just ain't so. When you use an exact search you will get just that. When you need to search using one of the other symbols (found in the status bar) of the FMP db in a find operation, you can easily adapt the exact search to suit those needs. When you do an "or" search you can all to easily get records from either both or none when using the tags you insist on using. The "or" search is doomed to failure prima facie. The -op and -lop tags work best in If conditionals on Format Files to determine text to be displayed. Sometimes you need to break your search into two or (ooooo, there's that word) more search opportunities. If you design that wisely your clients will not be offended. Perhaps you could accomplish what you desire by running a ScriptMaker script. They can be run safely over the web if you know how. I know how. My web site uses them.
Garry Claridge Posted February 15, 2002 Posted February 15, 2002 surwoop, I have had a chance to do some tests. Unfortunately I didn't have any luck after inserting the '-lop=or', the request treated each word of one of the fields as separate searches. This is how the "CDML Reference" database describes it. I am using FMP5.5v2 It is now head-scratching time looking for an alternative 'or' search on more than one field. All the best. Garry [ February 14, 2002, 10:28 PM: Message edited by: Garry Claridge ]
Garry Claridge Posted February 15, 2002 Posted February 15, 2002 I have created a calculated field which removes the spaces from 'FieldOne'; e.g. 'FieldOneTrim' = Substitute(FieldOne," ",""). This field can be used to assign the value to the token and then to be searched on. Hope this is heading in the right direction. Garry [ February 14, 2002, 10:29 PM: Message edited by: Garry Claridge ]
Keith M. Davie Posted February 15, 2002 Posted February 15, 2002 Is research good for the soul? "Logical operators evaluate multiple comparison expressions and return a Boolean result..." That is from FileMaker Pro 4 Companion by Maria Langer, p. 362. This book can be useful to the FileMaker Developer. It is over 600 pages long. I strongly recommend reading it cover-to-cover. I did. It has information which has proved invaluable to me. There is more about the -lop "or". Buy the book and read it.
Garry Claridge Posted February 15, 2002 Posted February 15, 2002 In Maria Langer's book "Database Publishing on the Web" page 283, she gives a description of using '-lop' for a multiple field search. However, the same problem will occur if the 'Last Name' entered was "Van Jones". The results would show: "Van Smith", "Van Bloggs", "Van", "Jones" and "Van Jones" (and this is with using an 'exact' match on 'Last Name'). This is not the intended result. Continually researching. Garry [ February 15, 2002, 01:10 PM: Message edited by: Garry Claridge ]
Keith M. Davie Posted February 16, 2002 Posted February 16, 2002 Garry,I think the key here is that we are trying to communicate with the database vis a vis the www. Sometimes it is necessary to understand how the database itself works. That is why I recommend understanding the exact search procedure as performed from the www - the references I give. My experience is if you cannot write the code for a db find as adapted from those two referenced documents, then no mattter what cdml tags you use, you cannot perform that db find. When that is the case, you must break your find into two or more parts. It is that simple. My experience is that the -lop and -op tags work best incorporated into unenhanced html when used in an If conditional on a format page to display text. And even then, you can probably do it another way which is more efficient. By unenhanced html I mean no JavaScript. This is not meant as a slam at JavaScript (and we can thank Netscape not MS [which copied NN by creating JScript, much like they copied Windows from Apple, in spite of the judge's decision] for that language), for JavaScript truly has a place in the Developer's language. I would further suggest that if one can do it in html/cdml, it can be more easily enhanced by JavaScript. If no one else has noticed, I believe that FMI's ads do make it seem that one can simply incorporate cdml into html. The reality is that the examples which FMI present all rely upon JavaScript - an added language which enhances, but is not inherent to html. I know because I tried to use their search example without the JavaScipt and, because it did not work, it put me on a six week search for those two documents. I would rather not discuss my feelings about FMI.
Garry Claridge Posted February 16, 2002 Posted February 16, 2002 Keith, Can you give an example of a two field "or" selection, with one of the fields containing words separated by spaces. All the best. Garry
Garry Claridge Posted February 16, 2002 Posted February 16, 2002 Here is a general hint towards the pure cdml method: [FMP-Record] [FMP-If: Field:FieldOne .eq. CurrentToken:0] ....cdml/html.... [FMP-ElseIf: FieldTwo .eq. myValue2] ....cdml/html.... [/FMP-If] [/FMP-Record] [FMP-Record] [FMP-If: Field:FieldOne .eq. CurrentToken:0 .or. Field:FieldTwo .eq. myValue2] ....cdml/html.... [/FMP-If] [/FMP-Record] However, a couple of practical hurdles need to be overcome before these will work properly. I believe that using a calculated field to remove spaces in one of the search fields maybe easier and more efficient than the pure cdml method. Being lateral. Garry
Keith M. Davie Posted February 16, 2002 Posted February 16, 2002 Garry, no I cannot provide an example. I have never tried an "or". The reason I have not is because my understanding of the "or" is that it is fraught with problems even greater than an exact search. The problems can be further exacerbated with a field containing two words. I tend to start from the premise: Answer first how to tell Paul Simon the singer from Paul Simon the Senator from Paul Simon the Nobel winning economist. This example works as a basis for most find operations which I perform. Sometimes one can have too many search criteria to be effective. That is why one must sometimes break things into parts. Even when constructing scripts they can get too long, complex and they must be broken into parts (sub-scripts). When it comes to the symbols which are in the Status Bar of your db during a find, you will note that an "or" does not exist as a symbol. Generally speaking, I believe that one is most likely to use any of the first six symbols (FMP 5) in the dropdown list. Again, I would refer you to the code which I posted under the recent thread about currentdate as an example of use of the symbols. Just add pointy brackets. edit -> Oh yeah, set the date parameters in the db of that example for American dating mm/dd/yyyy. Also under Turansky's currentdate thread I posted another reference for a symbol/code example which I had posted many months ago. One possible help with an "or" might be to perform the search manually. Go to the db, scripts, edit, and save that search for your (previously written) script (I'm not looking, but I think the choice is "Replace") Oh wait. That's right. I use scripts, but no one else does. HTH [ February 15, 2002, 10:07 PM: Message edited by: Keith M. Davie ]
Keith M. Davie Posted February 17, 2002 Posted February 17, 2002 Scripts are a feasible alternative. In fact, as we all know, they are very powerful. However, if a script (or two or more different scripts) are called in a near-simultaneous manner, one script will run and at least one will not run. Yet all clients will be advised of a successful transaction. This is because the engine which reads ScriptMaker scripts is single threaded. Please tell me if you have seen the various problems expressed. Do you have a way to handle the problems which can occur on a near-simultaneous request? I do. That is what my site is about. And anyone can challenge my solution by following the instructions and Hints contained therein. I am not concerned that you will be misinformed. Nor am I concerned that, if you follow the directions and resubmit as requested, any data will be lost or mishandled. And if you don't resubmit, it means you changed your mind at the last opportunity. The latter is not a problem of the solution.
Garry Claridge Posted February 17, 2002 Posted February 17, 2002 I believe using scripts is also a feasible alternative solution. All the best. Garry
Keith M. Davie Posted February 17, 2002 Posted February 17, 2002 surwoop, now that I have given you a very specific reference, do YOU understand the difference between an "and" and an "or"? What about an "xor"? Do you now know the meaning of Boolean? I have not heard back from you since I gave you that valuable resource. By your silence I trust that you have solved your problem. I would like to know how you handled it. Your providing that information would be, after all, fair to all future users of this valuable resource, the FM Forums.
surwoop Posted February 18, 2002 Author Posted February 18, 2002 Hi Keith, I havn't been able to reply to your posts because I have been away from my computer all weekend. Thanks for the reference to the book, I'll be traking it down. As for the problem, i'm going to strip the field of any spaces, the example calculation field that Garry posted above should do the trick nicely. Thanks again Surwoop
Keith M. Davie Posted February 18, 2002 Posted February 18, 2002 Thanks for your response. Please keep us informed. I don't think I've sent you down a primrose path.
Recommended Posts
This topic is 8412 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