User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 20 May 2005, 10:37   #1
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
User defined criteria on dataselection

I need suggestions as to how to deal with user-defined criteria on data selections.
I'm writing a module that allows the user to compose overviews, and dispite that it's pretty obvious how a user can add columns with user-defined calculations and how the data must be composed, I find it hard to think of a way how the user should be able to set criteria to the dataset that is retrieved.
For example, a user decides he only wants to see the data of employee 5.

Those things are easy, but to offer the most freedom, more complex criteria must be supported, and at the same time, it must be simple for the user.

For example, the user wants to see employees where the time worked is larger than 5hrs and smaller than 12hrs and the employee is 3, 4 or 5. The silliest things should be possible.

My main problem is how to offer the most freedom and keep it as simple as possible.

So far, the idea has been to offer a number of standard comparison operators like equal to, smaller than, larger than, smaller than or equal to, and have the user enter the two values that need to be compared. However, the problem is how to determine if a criterion should be AND-ed or OR-ed.
For example, if the user says that employee number should be greater than 5, smaller than 30, equal to 20, then should the result be "[EMPLOYEE] > 5 AND [EMPLOYEE] < 30 AND [EMPLOYEE] = 20" or "[EMPLOYEE] > 5 OR [EMPLOYEE] < 30 OR [EMPLOYEE] = 20". This ambiguity makes it hard for me to program, and hard for the user to understand exactly the effects of the criteria he enters.

To prevent this kind of ambiguity I've thought about letting the user enter the comparison string, but that doesn't quite fit in with the idea of "simple for the user". It's however the simplest for me to make.

My question is, are there any suggestions as to how the user should define these criteria? Or are there any programs out there that already offer such functionality and I can "borrow"?
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 25 May 2005, 01:36   #2
Karhig
Registered User
 
Join Date: May 2005
Posts: 2
Karhig is an unknown quantity at this point
Re: User defined criteria on dataselection

I don't know how much help I will be here, but here goes...

I guess there are three operators to be considered, "strictly-greater-than", "strictly-less-than" and "equality". There are also operators such as "greater than or equal" etc, but they can be made by the combination of the three operators trivially. You can also do negation in this way, also fairly trivially.

First off, equality. Equality should always be ORed with other operators, otherwise you will only return a result when that result is present (anything AND false IMPLIES false), so thats fairly easy to use.

I shall assume you are using SQL to get the results from a database, and as such you need to appreciate that you are applying a single logical selection statement repeatadly to rows. the SQL "SELECT foo FROM bah WHERE foo<10 AND foo>15;" doesnt return all foo's where foo is<10 and all foo's where foo>15, it return all foo's where foo<10 AND foo>15. Since this is a fallacy (something can't be both less than 10 and greater than 15) it will return no results. What you really wanted to do was return the conjuction of two sets of results, one set where foo>15 and one set where foo<10. As such you want to use the OR operator, logical OR is equivelent to set conjunction (logical AND is equivelent to set intersection).

Unfortunatly it isn't this easy really. If you want to return all foo's with numbers in the range 10..15 then you don't want to do "foo<15 OR foo>10", since everything is either less than 15 or greater than 10 this will return ALL foo's. Here you want to set use Intersection of the two sets, and so want to use AND.

You will need to determine if you are trying to select a range between two numbers (AND) or if you are trying to select everything but a those values falling between a range of numbers (OR). You could do this using negation (deMorgan's Law) but this would probably confuse the end user. Instead you will need some bit of logic that determines based upon the values and the operators what to do inside the SQL selection.

I hope this has helped clarify at least WHAT you need to do, even if it's not really offering solutions :/
Karhig is offline   Reply With Quote
Unread 25 May 2005, 13:01   #3
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: User defined criteria on dataselection

There are plenty of examples of friendly search pages. For example, http://www.google.co.uk/froogle_advanced_search. Combine simple idiomatic options like multiple choice, numeric ranges, and text fields.

I have to question your design criteria. Are you sure you want the silliest things to be possible? Could you not simply have "between the hours of..." rather than letting them choose any set at all? Is there any user demand for that? If it's appropriate, try asking customers what sort of searches they use. It definitely shouldn't be possible for me to specify "between 10 and 30" and "equal to 20" - that's just confusing.

If it absolutely has to offer absolute freedom, provide both options. A friendly search page, and an SQL interface. If you're doing anything complicated, you won't just need complicated searching, but also complicated analysis of that data. You can't provide a friendly interface to that.
__________________
#linux
queball is offline   Reply With Quote
Unread 25 May 2005, 14:38   #4
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: User defined criteria on dataselection

The current app allows the user to make simple selections on the data, and in most cases this is sufficient. However, this requirement is kind of nescesary because of the database design which is bloody awfull. You don't want to know what kind of trickage I had to do to get the dynamic table linking going.

I now offer "selectable criteria" that offer the user to select multiple values (ie: employee nr is 10 or nr = 11 or nr is 12 etc etc) and an advanced mode for static criteria.
My job here ends in three weeks, and I have a tonne of work to complete before this is customer ready. Probably more than three weeks, but after that it's not my problem anymore (I hope). So I'm going to take this shortcut and leave out most of the "sillyness" of these user-defined criteria.

Thanks for your input.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 25 May 2005, 17:38   #5
Caesar2
Commander
 
Caesar2's Avatar
 
Join Date: Sep 2001
Location: Netherlands
Posts: 146
Caesar2 is just really niceCaesar2 is just really niceCaesar2 is just really niceCaesar2 is just really nice
Re: User defined criteria on dataselection

You could make some kinda grid like e.g. the SQL Server query designer:
Code:
 Field      Sort       Criteria
+----------+----------+----------+
|          |          |          |
+----------+----------+----------+
If you need more fields, add rows. If you need more criteria, add columns:
Code:
 Field      Sort       Criteria   Or
+----------+----------+----------+----------+
|          |          |          |          |
+----------+----------+----------+----------+
|          |          |          |          |
+----------+----------+----------+----------+
|          |          |          |          |
+----------+----------+----------+----------+
All criteria in 1 column represent AND. A second column represents OR.
This won't be easy, but maybe you can use some db tools?
BTW Access has also such a designer, but has the rows and columns switched.
__________________
Quote:
Originally posted by Cochese
Cathaar are not overpowered.

You were just "bashed", live with it.
Caesar2 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 07:00.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018