不是QQ:需要有关如何编写完整查询用户界面的想法 [英] Not a QQ: Need ideas on how to write complete query user interface

查看:70
本文介绍了不是QQ:需要有关如何编写完整查询用户界面的想法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我会尽量简短:



我项目的当前部分涉及从电子表格中获取数据,对数据进行调整,然后将其上传到实时数据库。我现在有了数据,需要弄清楚如何进行调整。



问题是调整不是一成不变的。在某些情况下,它们可以每天更换一次。我的MD将首先使用该系统,但我们希望在某些时候将其与其他大型产品商业化。



我需要一个明确的机制来允许用户决定需要对数据进行哪些调整。





这些调整的一些例子(我将称之为规则)如下:



XML格式让它更容易在这里阅读(我希望!),但我可能必须存储这样的规则集。



以下规则选择ProdCode以TL开头的行和PClass是3或4.

它然后创建重复项并设置数量上限和下限调整每个的价格

Hi,

I'll try to be as brief as I can:

The current leg of my project involves taking data from a spreadsheet, making adjustments to the data and then uploading it to a live db. I now have the data and need to work out how to make the adjustments.

The issue is that the adjustments are not set in stone. They can change as often as daily in some cases. My MD will be using the system at first, but we will want to commercialize it along with another large product at some point.

I need a clear mechanism to allow the user to dictate what adjustments need to be made to the data.


Some examples of these adjustments (I'm going to call them Rules) below:

XML format just makes it easier to read here (I hope!), but I'll probably have to store the rulesets like this.

The following rule selects rows where ProdCode begins with "TL" and PClass is either 3 or 4.
It then creates duplicates and sets the qty upper and lower bounds adjusting the rates for each

<RuleSet supplier="MySup" ValidFrom="01/01/01">
  <Rule>
    <RowSelectors>
    <AND>
      <Selector Column="ProdCode" BeginsWith="TL" />
      <OR>
        <Selector Column="PClass" Equals="3" />
        <Selector Column="PClass" Equals="4" />
      </OR>
    </AND>
    </RowSelectors>
    <RowOperations>
      <Duplicates>
        <Duplicate>
          <Set Column="Upper" Value="1" />
          <Set Column="Upper" Value="1000" />
          <Add Column="DayRate" Value="0.1" >
        </Duplicate>
        <Duplicate>
          <Set Column="Upper" Value="1001" />
          <Set Column="Upper" Value="4000" />
          <Add Column="DayRate" Value="0.2" >
        </Duplicate>
        <Duplicate>
          <Set Column="Upper" Value="4001" />
          <Set Column="Upper" Value="10000" />
          <Add Column="DayRate" Value="0.3" >
        </Duplicate>
      </Duplicates>
    </RowOperations>
  </Rule

</RuleSet>





我不小心你,这是目前最简单的有效规则,有27种不同的ProdCode start with具有不同的值



我可以从这样的规则集中获取代码端,但是我将如何呈现UI中的这些选项。那里有例子还是有类似的产品我可以看看?



谢谢

Andy



I kid you not, this is the simplest currently valid rule and there are 27 different "ProdCode starts with"'s with different values

I could get the code side to work from a ruleset like this, but How would I present these options in a UI. Are there examples out there or is there a similar product that I can look to?

Thanks
Andy

推荐答案

听起来你需要能够

(a)加载之前保存的规则

(b)保存修改后的规则
(c)允许用户添加新规则,和/或编辑或删除现有规则

...所以,你需要一个规则定义网格,带有添加/删除按钮和并网编辑

(d)可能希望保存谁做了什么跟踪数据,当有人声称他们没有搞乱规则变更时



规则定义网格条目需要一个选择部分和一个操作部分。



选择部分必须让用户选择一个选择列(选择列表可用列),比较操作(可用选项的下拉列表)和比较值(文本框)。

它还必须允许用户添加OR子句。如果你需要AND和OR,你可能想在网格渲染中添加一个图形,以使AND和OR子句的相对分组清晰。



操作部分,好吧,我无法从你的XML中确切地知道允许哪些操作,但我希望你可以从我对于Selection部分的建议推断如何为操作部分构建一个UI。



HTH,

Chris
Sounds like you need to be able to
(a) load prior saved rules
(b) save amended rules
(c) allow user to add new rules, and/or edit or remove existing rules
... so, you need a grid of rule definitions, with add/remove buttons and in-grid edit
(d) probably want to save 'who did what' tracking data for when someone claims they didn't mess up a rule change

A rule definition grid entry needs a selection section and an operation section.

The selection section must let the user pick a selector column (pick list of available columns), a comparison operation (drop down list of available options) and a comparison value (text box).
It also must allow the user to add 'OR' clauses. If you need AND as well as OR, you may want to add a graphic in the grid rendering to make the relative grouping of AND and OR clauses clear.

The operation section, well, I couldn't figure out from your XML exactly what operations are permitted, but I expect you can infer from my suggestion for the Selection section how to build a UI for the operations section.

HTH,
Chris


fyi:你可能想在这里阅读或发布设计和建筑论坛;您是否注意到Kevin Marois在您之前发布的帖子中发布了一个问题? [ ^ ]



将规则映射到代码的问题



假设你创建了一个您的老板可以理解的UI,然后您可以通过该UI中的直接操作生成/编辑一系列规则(一个很大的假设!),考虑您现在可以根据这些规则采取行动来过滤数据。



a。您为独特的DSL(特定于域的语言)编写自己的解析器。这可能会使你的工作延长几个月。解析器将通过使用Compiler.Emit等创建表达式树来生成可执行代码/对象。



b。您将自定义解析器的规则映射到SQL(非平凡)



c。你找到了一种方法来挂钩C#编译器并在字符串中执行任意代码。



c.1使用Visual Studio 2015和Roslyn编译器,有一个新的脚本NameSpace中的工具:Microsoft.CodeAnalysis.Scripting.CSharp。



c.2 C#有很多脚本编写示例;你需要研究它们。你甚至可以在Visual Basic中使用'Eval代码(虽然,我不会)。看看ReoScript:[ ^ ]。



用户界面创意:



a。几年前我做了一个看起来像这样的项目:



a.1 UserControl'LogicFactory可滚动



a.1.a包含一个Panel停靠的'Top,带有一些控件,比如一个Button来添加一个新的LogicSelector,一个Button来评估结果



a.2包含一个LogicSelector UserControls集合,停靠'Top



b。 UserControl'LogicSelector不可滚动



b.1包含一些ComboBox,其内容随其他ComboBox中的选择而变化。用户可以从各种目标中进行选择,并从各种操作中进行选择。



c。它是如何工作的:



c.1用户一直在添加LogicSelector控件,直到他们输入所有选择,在某些时候调用evaluate工具。



c.2评估工具迭代了LogicSelectors的集合,并做了正确的事情来对目标采取行动。



事后来看:写作需要做很多工作;添加新功能很困难。让所有ComboBox与正确的项目保持同步的任务涉及一些花哨的舞蹈。



我希望你知道你所描述的那种项目类型(数据挖掘,决策树构建,数据分析)经常使用花费数千美元的现有业务逻辑/规则建模软件。我会根据推断,从你所说的,老板真的不太了解他想要的东西,在不到一年的时间内将你完成这个项目的机会评价给你老板的满意度。



但是,对你来说这是一个很好的学习机会:)



建议的研究领域:



1.决策表格/树木



从这里开始:[ ^ ]



在CP上:[ ^ ]



开源:[ ^ ] ......很多其他人在那里



商业广告并使用C#:[ ^ ] ......其他人在那里



最后,你知道吗?有几个强大的(从廉价到昂贵的)Excel附加组件,您可以在Excel中进行决策建模和分析?建议你不要向老板提及这些。
fyi: you might want to read, or post to, the Design and Architecture Forum here; did you notice that Kevin Marois has posted a question there inspired by one of your previous posts ? [^]

The Problem of mapping Rules to Code

Assuming you have created a UI your boss can understand, and you then have a series of rules generated/edited by direct action in that UI (a large assumption !), consider how you might now take action based on those rules to filter the Data.

a. you write your own parser for a unique DSL (domain specific language). that will probably extend your employment by several months. said parser will generate executable code/objects by creating Expression Trees, using Compiler.Emit, and whatever.

b. you map the "rules" by a custom parser to SQL (non-trivial)

c. you find a way to hook into the C# compiler and execute arbitrary code in strings.

c.1 with Visual Studio 2015 and the Roslyn compiler, there is a new scripting facility in the NameSpace: Microsoft.CodeAnalysis.Scripting.CSharp.

c.2 there are numerous examples of scripting for C#; you need to research them. You could even use the 'Eval code in Visual Basic (although, I wouldn't). Check out ReoScript: [^].

User Interface ideas:

a. a few years ago I did a project that looked like this:

a.1 UserControl 'LogicFactory scrollable

a.1.a contains a Panel docked 'Top, with some controls, like a Button to add a new LogicSelector, a Button to evaluate the "results"

a.2 contains a Collection of LogicSelector UserControls, docked 'Top

b. UserControl 'LogicSelector not scrollable

b.1 contains some ComboBoxes whose contents vary with the selections made in the other ComboBoxes. The user can select from various "targets" and select from various operations.

c. how it kind-of worked:

c.1 the user kept adding LogicSelector controls until they had all their choices entered, at some point invoking the "evaluate" facility.

c.2 the evaluate facility iterated over the collection of LogicSelectors and "did the right thing" to act on the "target."

With hindsight: it was a lot of work to write; it was difficult to add new functionality to. The task of keeping all the ComboBoxes in synch with the right Items involved some fancy dancing.

I hope you are aware that the kind of project you describe is of the type (data-mining, decision-tree construction, data analysis) where existing business-logic/rule modeling software costing many thousands of dollars is often used. I would rate the chances of your completing this project to your boss' satisfaction in less than a year as low, based on the inference, from what you say, that the boss really doesn't quite know what he wants.

But, what a great learning opportunity for you :)

Suggested areas for you to research:

1. Decision Tables/Trees

start here: [^]

on CP: [^]

open source: [^] ... lots of others out there

commercial and works with C#: [^] ... others out there

Finally, are you aware there are several powerful (from cheap to pricey) add-ons for Excel where you can do the decision modeling and analysis in Excel ? Suggest you not mention these to boss.


这篇关于不是QQ:需要有关如何编写完整查询用户界面的想法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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