如何在Web窗体GUI中实现用户友好的布尔逻辑? [英] How can I implement user-friendly boolean logic in a web form GUI?

查看:94
本文介绍了如何在Web窗体GUI中实现用户友好的布尔逻辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我有一个Web应用程序,用户可以在其中使用下拉列表生成SQL SELECT语句,如下所示:

Currently I have a web application where a user can use dropdown lists to generate SQL SELECT statements like so:

列选择下拉列表|运算符下拉菜单(=!=><< => =)|值选择下拉列表

Column Select Dropdown | Operator Dropdown (= != > < <= >=) | Value select dropdown

用户可以多次执行此操作,并且当前过滤器"已全部与"在一起.

The user can do this multiple times, and the "filters" are currently all ANDed together.

我想添加创建OR语句的可能性.在列相同的情况下,我可以很容易地添加OR,但是像

I want to add the possibility of creating OR statements. I could very easily add ORs in the case where the columns are the same, but what about complex logic statements like

(((A OR B OR C)AND(D OR E))或(F AND G)?

((A OR B OR C) AND (D OR E)) OR (F AND G)?

如何让用户以用户友好的方式创建此类语句?

How can I let users create such statements in a user-friendly way?

要指定,对于一般用户来说是用户友好的.目前,我与开发人员合作,这些开发人员偶尔为需要数据库中特定信息的非技术客户手动编写SQL查询代码.我们的目标是通过提供给客户一个易于使用的工具来自行完成此Web应用程序,从而使我们无需手动编写代码.

To specify, user-friendly for a general audience. Currently I work with developers that occasionally hand-code SQL queries for a non-technical client that needs specific information from our database. The goal is that this web app will remove the need for us to hand-code them by giving the client an easy-to-use tool to do it themselves.

当前该应用程序尚未由最终用户使用.关于它的用途,我仅有的数据是以前的手写SQL查询,因此是客户要求的查询类型.鉴于我可以简化它(例如,将用户生成查询的能力限制为他们倾向于要求的那种查询),但是我想看看是否有人在GUI中简单,完全地传达布尔逻辑.

Currently the app is not being used by end users. The only data I have as to its use are previous handwritten SQL queries and thus the kind of queries the client asks for. Given that I could simplify it (e.g. limit the users' ability to generate queries to the kinds of queries they tend to ask for), but I want to see if anybody has experience communicating boolean logic simply and completely in GUIs.

谢谢您的时间.

推荐答案

当您需要处理( (A or B) and C) or (D or E or F)时,您正在使用树状数据结构.以我的经验,没有一种简单的方法可以以漂亮"或直观"的方式向用户表示决策树.在ASP.NET Web表单中,这是双重困难.

When you need to handle ( (A or B) and C) or (D or E or F), you're working with a tree-like data structure. In my experience, there's no easy way to represent decision trees to users in a "pretty" or "intuitive" way. Its doubly hard in ASP.NET webforms.

但是,一种可行的方法如下:接受where子句的单个文本框.相信我,单输入法确实是最简单直观的用户界面,它还具有*允许快速输入/修改查询过滤器的优势*.

However, one tried and true approach is the following: single textbox accepting a where clause. Trust me, the single-input approach really is the most simple and intuitive user interface, and it also has the advantage* of allowing rapid input/modification of query filters.

**从技术角度来看,另一个优势是能够编写自己的词法分析器/解析器和AST.在基本的Crud应用程序中,您有多少次这样做:)*

** Another advantage, from the technical side, is being able write your own lexer/parser and AST. How often do you get to do that in a basic crud app :)*

您已经在训练用户如何使用即席查询引擎,也可以训练他们使输入(account.Balance < -2000 and account.Type == 'Checking') OR (account.Number = 123456)完全返回其返回的内容.

You're already going to be training your users how to use your ad hoc query engine, you may as well train them that typing (account.Balance < -2000 and account.Type == 'Checking') OR (account.Number = 123456) returns exactly what it says it returns.

如果采用这种方法,请向用户提供可用列的下拉列表,以便双击某个项目将其插入到光标所在位置的文本框中.

If you go with this approach, provide the user with a dropdown list of available columns, so that double-clicking on an item inserts the item into the textbox at the cursor location.

这篇关于如何在Web窗体GUI中实现用户友好的布尔逻辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆