Inmagic Forums
Inmagic Forums
Scripting
Display Record Count or Number of Hits before running a canned search|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
I am creating a browse by topic option for users who prefer browsing to searching.
Is there a script that can dynamically display the record count or even the number of hits for a particular entry in a field before the search is run? So for example if I had canned query links to allow users to browse by subject could the number of records with those subjects display in brackets before the query is clicked and the search results displayed? eg. Click on links to browse books on: birds (2) reptiles (4) mammals (7) |
|||
|
Hi Jenn ---
I think this could be achieved, but I don't think it would be easy. Part of the info that comes back with a requested index list is the number of times the entry appears in the index, which is exactly what you're after. Let's say you were trying to get this info for "Ford Mustang": DB/WebPublisher http://localhost/dbtw-wpd/exec/dbtwpub.dll?ac=index_by_...me&en=ford%20mustang CS/WebPublisher http://localhost/ics-wpd/exec/icswppro.dll?ac=index_by_...me&en=ford%20mustang You'll notice this info comes back as XML: <inm:Results productTitle="Inmagic DB/Text WebPublisher PRO" productVersion="8.00.1" oex="ISO-8859-1"> <inm:ListSet AC="index_by_key"> <inm:List fieldName="Name" type="term" key="ford mustang" offset="0"> <inm:Entries count="13"> <inm:Entry count="1">Ford Mustang</inm:Entry> <inm:Entry count="1">Jaguar XJ6</inm:Entry> <inm:Entry count="1">Mazda RX 7</inm:Entry> <inm:Entry count="1">Mercedes Benz</inm:Entry> <inm:Entry count="1">Nissan 300 ZX</inm:Entry> <inm:Entry count="1">Pontiac Trans Am</inm:Entry> <inm:Entry count="3">Porsche</inm:Entry> <inm:Entry count="2">Road Boss</inm:Entry> <inm:Entry count="2">Supra</inm:Entry> <inm:Entry count="1">Toyota Land Cruiser</inm:Entry> <inm:Entry count="2">TX Cruiser</inm:Entry> <inm:Entry count="1">Volvo 960</inm:Entry> <inm:Entry count="2">Winger</inm:Entry> </inm:Entries> </inm:List> </inm:ListSet> </inm:Results> So... you would need to parse that XML to retrieve the value you want. Also, if you were going to do this for x canned queries, you would be hitting the database x times, which would start affecting the browse page performance. Peter Tyrrell, MLIS Senior Consultant Andornot Consulting Inc. http://www.andornot.com/about/developerblog |
||||
|
Hmm... very interesting. I will keep that in mind for other things...
However, in this case, I realized there is an easier way to do this within the software. I created a basic report which just lists the subjects sorted alphabetically. I created a canned query using a combination of html text boxes and SortKeys to display the subject as a clickable link to run a canned query. I then put a calculation Count(1) to list the number of records with that subject and made the whole box a sort footer so that the calculation would work. This accomplished exactly what I wanted. eg. For Webpublisher (for content server change dbtw-wpd/exec/dbtwpub.dll to ics-wpd/exec/icswppro.dll in the canned query string). 1) Put a compulsory sort by Subject and add a text box. In the text box add the following text and treat as html: <a href="http://localhost/dbtw-wpd/exec/dbtwpub.dll?BU=http%3A//localhost/dbtw-wpd/textbase/Expert/search_new.htm&TN=Topics&QY=find%20(Subjects%20= 2) Add a Sort Key: Level 1 3) Add the following text and treat as html. I also added &MR=50&CS=1 to set my maximum records and cascading style : )&RF=Reportformname&DF=Displayformname&NP=2&RL=0&DL=0&XC=/dbtw-wpd/exec/dbtwpub.dll&ID=&AC=QBE_QUERY"> 4) Sort Key: Level 1 5)Add the following text and treat as html : </a> 6) Calculated Value: Count(1) 7) Make the box a Sort Footer Level 1 This message has been edited. Last edited by: JennM, |
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Inmagic Forums
Inmagic Forums
Scripting
Display Record Count or Number of Hits before running a canned search
