clevow Posted February 18, 2002 Posted February 18, 2002 Is there any way to retain the search results so that a user can go back to them easily? For example, if a user searches for all records created today, then goes and modifies one, then wants to go back to the list of results. The only way I can see to do that is to actually execute the search again, in which case the user needs to remember what he actually searched for. The initial search will be done via a form, not a URL. Thanks, Carrie
Jeff Spall Posted February 18, 2002 Posted February 18, 2002 Hi, we have a database that you might be able to adapt for your need In my solution, our users do a search and the search return page gives them a url for the search that they can email to a client: <TABLE BORDER=0 CELLSPACING=0 WIDTH=450> <TR> <TD> <P><FONT SIZE="-1" FACE="verdana,arial,geneva,sans-serif">search results for: </FONT>[FMP-CURRENTFIND] <FONT SIZE="-1" FACE="verdana,arial,geneva,sans-serif">[FMP-FINDVALUEITEM: HTML]</FONT> [/FMP-CURRENTFIND]</P> </TD> </TR> <TR> <TD> <P><FONT SIZE="-1" FACE="verdana,arial,geneva,sans-serif" COLOR="#000066"><B>To share the search, copy and paste this link into your email:</B></FONT></P> </TD> </TR> <TR> <TD BGCOLOR="#6699CC"> <P><INPUT TYPE=text NAME=search_url VALUE="http://mydomain.com/advertsf/[FMP-Link:%20ra]&-Format=client_search_results.htm&-Find" SIZE=81></P> </TD> </TR> </TABLE> So,made the text field in my example into a url link it would restore the search. You could pass it from page to page in a token. regards, jeff PS. Inside the token, you'd have to substitute { } for [ ] as FileMaker hates nested [ ]s
clevow Posted February 18, 2002 Author Posted February 18, 2002 duh. okay i can use the fmp-link tag. didn't even think about that. thanks for the reminder Jeff.
clevow Posted February 18, 2002 Author Posted February 18, 2002 unfortunately, there could be up to 15 items searched on. so i can't use each value separately.
Garry Claridge Posted February 18, 2002 Posted February 18, 2002 You could use a little Javascript. In particular the 'escape()' function to convert the string. I'm not sure what it does with '&' though. Good Luck. Garry p.s. I just thought about this a bit more and escape() is not going to do the job -( [ February 18, 2002, 01:20 PM: Message edited by: Garry Claridge ]
clevow Posted February 19, 2002 Author Posted February 19, 2002 hmmm.... only problem with that is that filemaker will only pass part of the token in the URL. if the token is FMPro?-db=2001cd_files.fp5&-lay=file&-op=eq&size=2048&-op=cn&access=r&-lop=or&-skip=4 it'll only pass it up until the first &. After that, it no longer sees it as part of the token - it's just part of the URL. Any way around that?
Garry Claridge Posted February 19, 2002 Posted February 19, 2002 If you don't have many parameters in your search you could just pass the values as tokens. Then reuse them within a form. All the best. Garry
Jeff Spall Posted February 19, 2002 Posted February 19, 2002 Hi, yes, you're right about the '&' - I have the same problem embedding these within a 'mailto' tag. A real clunk workround might be to use a database to hold it. Submit the url to a database field with an inline action and then find that record (-another inline??) and use the field contents when you want to recall it?? regards, jeff
clevow Posted February 19, 2002 Author Posted February 19, 2002 Aha! I've found a way! It's kind of nasty, but it'll do. Since I'm sure other people have wanted to do this, I'll explain what I did. First, a little background info. The search that I'm trying to duplicate is one that will return a list of files, some of which have been reviewed. The files live in one database ("2001cd_files") and the reviews live in another ("2001cd_edits"). From this search results page, you can view the details on the file (which comes from the files database) or you can add a review. If you're going to view the file, I figure the natural tendency will be to hit back on the browser to go back to the search results, so I'm not concerned about that. It's people that enter new reviews that are the problem. So I made the link that you click on to do a new review as follows (relevant parts in bold) <a href="localhost:591/cd/FMPro?-db=2001cd_edits.fp5&-lay=edit&-format=new_review.html&fileid=[fmp-field:recid]&-token.2=[fmp-field:recid]&unity_id=[fmp-currenttoken]&search=[fmp-c urrentfind] [fmp-findopitem:short] {[fmp-findfielditem]}[fmp-findvalueitem][/fmp-currentfind]&sort=[fmp-currentsort]{[fmp-sortfielditem]}{|[fmp-sortorderitem]|}[/fmp-currentsort]&max=[fmp-currentmax]&lop=[fmp-curren tlop]&skip=[fmp-currentskip]&-new"> "search", "sort," "max", "lop" and "skip" are new fields I created in the 2001cd_edits database. The "max," "lop" and "skip" fields get populated with the current selections that returned this search results page. The "search" field will be populated with all of the fields, operators, and values used for these search results. The "sort" field will be populated with the SortFieldItem (s) and SortOrderItem (s). The { } and {| |} are used for separators. They don't get interpreted in the URL. A real search would look something like this (irrelevant parts removed): search= gt {size}5000&sort={file_name}{|ascend|}{next_step}{|descend|}{directory}{|ascend|}&max=50&lop=and&skip=52 Okay, on to the database side. I created the fields referenced above, as well as the following calculation fields: fixed_search1, fixed_search2, fixed_sort, and fixed_skip. Let's start with the easiest first. fixed_skip: Int( skip/max ) * max I wanted this because the skip number wasn't working as I wanted it to. If you had -max = 25 and you were adding a review on the 2nd record, then your skip would = 2. When you go to the URL using 2 as a skip, it'll display records 2-26 instead of 1-25. This calculation fixes that problem. fixed_search1: This was used to eliminate partial words. Meaning, if your operator is gt, gt is a part of gte. No good. So this replaced gte, lte, and neq with GTEQ, LTEQ and NOEQ. This used the following nasty nested substitute combination: Substitute(Substitute(Substitute(search, " gte ", " GREQ "), " lte ", " LTEQ "), " neq ", " NOEQ ") The leading and trailing spaces were used just in case someone searched on gte. This ensures they're whole words. fixed_sort: This took the "sort" field and used substitutions to turn it into the sort part of a URL. Unfortunately, this required putting in a substitution for every field. There may be a better way to do this. Here's the calculation: Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Subs titute(sort, "{action}", "-sortfield=action&"), "{last_reviewer}", "-sortfield=last_reviewer&"), "{next_step}", "-sortfield=next_step&"),"{status}","-sortfield=status&"), "{notes}", "-sortfield=notes&"), "{file_name}", "-sortfield=file_name&"), "{directory}", "-sortfield=directory&"), "{full_path}", "-sortfield=full_path&"), "{UID}", "-sortfield=UID&"), "{size}", "-sortfield=size&"), "{last_update_date}", "-sortfield=last_update_date&"),"{last_update_time}","-sortfield=last_update_time&"), "{access}", "-sortfield=access&"), "{extension}", "-sortfield=extension&"), "{web_path}", "-sortfield=web_path&"),"{|ascend|}","-sortorder=ascend&"),"{|descend|}","-sortorder=descend&") fixed_search2: This is similar to the "fixed_sort" field, except it makes different substitutions. It also concatenates all the necessary pieces together to form a real URL. "http://localhost:591/cd/FMPro?-db=2001cd_files.fp5&-format=search_results.html&-lay=file"& Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Subs titute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(Substitute(fixed_search1, "{action}", "action="), "{last_reviewer}", "last_reviewer="), "{next_step}", "next_step="),"{status}","status="), "{notes}", "notes="), "{file_name}", "file_name="), "{directory}", "directory="), "{full_path}", "full_path="), "{UID}", "UID="), "{size}", "size="), "{last_update_date}", "last_update_date="),"{last_update_time}","last_update_time="), "{access}", "access="), "{extension}", "extension="), "{web_path}", "web_path=")," eq ", "&-op=eq&"), " cn ", "&-op=cn&"), " bw ", "&-op=bw&"), " ew ", "&-op=ew&"), " gt ", "&-op=gt&"), " GREQ ", "&-op=gte&"), " lt ", "&-op=lt&"), " LTEQ ", "&-op=lte&"), " NOEQ ", "&-op=neq&")&"&-max="&max&"&-lop="&lop&"&-token="&unity_id&"&-skip="&fixed_skip&"&"&fixed_sort&"-find" So, fixed_search2 is now the correct URL to repeat the find. From there, I stored it as a token. Then I used "redirect2.html" as the -format file for submitting a new review. Redirect2 has a meta-refresh tag with a 0 wait time and URL equal to the token. <meta http-equiv="refresh" content="0;URL=[fmp-currenttoken:9]"> It took most of the day to put together, but it works exactly as I want it to. Thanks to those who tried to help. If anyone would like more clarification on this, post and I'll reply. -Carrie _______________ Note: I found that Netscape didn't like the spaces in the URL. I replaced all the spaces with * and that worked fine. [ March 08, 2002, 08:54 AM: Message edited by: Carrie ]
Garry Claridge Posted February 20, 2002 Posted February 20, 2002 Carrie, Would you be able to submit the request, containing the url token, via a form and not a URL! Alternately, you can store the url in a Javascript variable. This variable can be keep persistent, and global, in an 'IFRAME' All the best. Garry
Recommended Posts
This topic is 8311 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