logo

Updated Domino Search Builder -- Now With Logic

Back to the "Search Builder" I mentioned on Wednesday. I asked what the logic should be to build a SELECT string based on a user's choice of fields and values (expecting a simple(ish) answer) and was re-assured to see that there isn't a simple way to achieve this.

Based on your feedback and that of the customer I've revised the Search Builder to cater for bracketed search terms. Quite a few of you suggested there be some way of the user wrapping groups of criteria inside open and close brackets. The customer agrees this (along with user training) is the way to go.

The thing that troubled me was how to allow this in a logical and user-friendly way. In the end I think I've come up with a nice and simple interface. See below:

Notice the grey ("knocked back") brackets to the sides of each "filter". Hover over them and you'll see they're clickable. Click one and it turns black to denote it's enabled. As you're doing this note how the search query is rebuilding itself at the bottom.

All that's missing is some rudimentary error-checking to make there are as many close brackets as open and vice-versa.

How Did I Do This?

The best solutions are always the simple ones. All I did here was add two part-hidden CheckBox elements. The brackets you see are the labels to the checkbox. When you click them it's selects the checkbox. You just can't see it.

The Flex code (MXML) to do this looks like:

ScreenShot001

The GridItem is the equivalent of a TD in HTML. By setting the "cell" to a width of 10 pixels we've hidden the checkbox as it's only wide enough to show the label (which is set to appear to the left of the checkbox.

Note also that I've used the CheckBox's color property bind to its selected state. If it's ticked it's black, otherwise it's light grey.

Bettering It

What do you think? Is this the best approach? It certainly seems like it could build any combination of criteria in any way you could ever want it to. You can nest bracket-terms as deep as you like.

Feedback welcome.

Comments

  1. Hi Jake,

    Congratulations !

    I think you've made the "best" search for end users.

    Thanks for your efforts

    • avatar
    • Selcuk A
    • Fri 27 Feb 2009 06:17 AM

    Hi,

    Is the date format universal in Domino full text search or is it dependent on the regional settings of the server?

    Thanks for the great tool

    • avatar
    • Jake Howlett
    • Fri 27 Feb 2009 06:46 AM

    Good question Selcuk. I think it's dependent on the server's settings but am not 100% sure.

    • avatar
    • Rob
    • Sat 28 Feb 2009 02:07 PM

    That is just beautiful, Jake. I may have to get into Flex sooner than I thought.

    I wanted to see if I could do XOR and it worked beautifully.

    SELECT (title="A" & ! title="B") | (title="B" & ! title="A")

    However, if I wanted to do

    SELECT ((title="A" & ! title="B") | (title="B" & ! title="A")) & unit_value<10

    I'd be out of luck because I can't add another level of brackets. But I don't think your application requires logic that many levels deep. I just always want a totally general solution to things, which can be too complex to be useful.

    I also wonder if you generate unique id strings for each "knocked back" bracket (parenthetically speaking, we yankees call them parenthesis)? I tried to look at the code but, of course, it's hidden inside the swf file.

    Peace,

    Rob:-]

    • avatar
    • Jake Howlett
    • Sat 28 Feb 2009 04:05 PM

    Hi Rob,

    Glad you like!

    I'd noticed that shortcoming whereby you can't nest exactly as you might need to. I just can't see how we could handle that with a simple GUI interface though.

    Actually the bracket checkboxes just have IDs of "begin" and "end". They don't have to be unique as they're in a component. Each row/filter is based on this component and so ID uniqueness is handled by the component. It's different to HTML in lots of ways. So much better. Get a copy of Flex - you'll love it!

  2. Hi Jake - those clickable brackets are fairly brilliant. Just a bit of training (one sentence) and it's clear what the purpose is. Nicely done!

    • avatar
    • Rob
    • Mon 2 Mar 2009 12:04 AM

    Jake,

    I got an idea to generalize the brackets but I don't see how to make it pretty. All you need is a way to add an arbitrary number of brackets where ever you now have the clickable brackets. One way would be to have a number field. If you need three brackets you put a 3 in there. If you need four brackets you put a 4 in.

    Or it could be spin-box with an up and down icon. One increments the count, the other decrements it.

    It's not as pretty as what you've got now but it is general. That's why I'm a developer and not a designer.

    Peace,

    Rob:-]

    • avatar
    • Aritz
    • Mon 2 Mar 2009 09:34 AM

    Hi Jack,

    Would it be possible to gather together all your flex samples to download? (or is it possible to download the accounts.nsf? i can't find the url ..)

    I find this articles very interesting! :-)

    Thank in advance

  3. Hi Jake,

    Brilliant! I love the hidden checkbox idea, and its a very nice looking search builder.

    Thanks for waking-up my grey-matter on a Monday

  4. Hi Jake,

    Amazing app. Very good UI and the use of brackets to handle AND/OR is just awsome. I just found one bug :)

    I created 3 rows and put a bracket before 2nd row and at the end of the 3rd row. Now i delete the 2nd row. So ideally the bracket should go away, but its there at the end of the 3rd row.

    • avatar
    • Jake Howlett
    • Tue 3 Mar 2009 09:44 AM

    Now that's just being nit-picky Nikhil!

    Although my plan is to build in a little more logic so it can add/remove close from the end to match the number of brackets open.

    • avatar
    • Jason Boardman
    • Tue 3 Mar 2009 11:54 AM

    Looks great - though I've noticed a bug when manually changing the price value, it doesn't seem to update the search string

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Fri 27 Feb 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content