Classic Domino Search Trick

There is less classic Domino work around then there used to be ( Pure Java, mobile and Xpages taking up most of my time), but still plenty of maintenance work for those who can provide what the client wants, any way, this is something I just updated on an existing clients classic app, and it struck me that it MUST be known by just about every one, but either no one has blogged it, or my Google foo is weak at the moment, so I decided to post it in case I might be of some use.

Problem: you have a classic search form, and you want to analyse or work with the results (making totals or stuff like that), but need to somehow get hold of the values in order to do so, I can remember this being a complete PITA years ago, but with a fresh set of eyes its dead easy.

Solution:

1) Make your searching view a HTML one (via the view properties).

2) Make a column that returns a hidden field for each row for the value(s) that you want to access.

"<td>" + "<input name="PostCodeSearchValue"  value="" + PostCode + "" type="hidden" />" + "</td>"

3) Now when you search, you can go a fetch all these values with client side java script.

var coll = document.getElementsByName("PostCodeSearchValue");
var arr = [];
for (var i = 0; i < coll.length; i++) { 
 arr[i] = document.getElementsByName("PostCodeSearchValue").item(i).value;
 }

and do what ever you want with them.

Now that lacked a bit description wise, so here is a demo and working download for you to take to bits

Demo: Here , Just Click “Search” to get a bunch of data to work with and then “Find Unique Postcodes” to run a bit of Javascript over the result to find and display the unique Post Codes in the returned data

DownLoad: You can get the file Here

ahhh, History…

update: Matt White has pointed out that this produces invald HMTL (working but invalid), and suggests using a JS framework and doing the same sort of “find” but using a CSS Class name… a fine point

Old Comments
————
##### Mark(07/06/2012 16:24:22 GDT)
Does that mean you are making a separate search call? rather than a local bit of JS dealing with the data you already have? if you were wanting to total a value for the items the existing search had returned how would you be doing that in the context of a $$search form?
##### Mark Barton(07/06/2012 15:59:29 GDT)
Yes – rather than HTML in the search view columns just construct JSON data, or am I missing something?
##### Mark Barton(07/06/2012 15:28:30 GDT)
Couldn’t you just return JSON?
##### Mark(07/06/2012 15:31:32 GDT)
as part of the search form data?

Leave a Reply

Your email address will not be published. Required fields are marked *