Xpages 如何获取/创建这个计算模块 [英] Xpages how to obtain/create this calculations module

查看:27
本文介绍了Xpages 如何获取/创建这个计算模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须根据文档中的一些字段值来完成一些包含一些计算(递归计算)的任务.比如说,创建一些发票.

We have to achieve some task consisting in some calculations ( recursive calculations ) based on some fields values inside the doc. Let say, for example, creating some invoices.

在一些旧的经典 Lotus Notes 应用程序中,我们刚刚创建了一个 24 行 4 列的表格,每个单元格都是一个可编辑/计算字段.您可以想象我们在每个字段中输入了什么样的公式,考虑到当前字段行是基于前一个字段行的值等等.

IN some old classic lotus notes applications, we just created a table with 24 rows and 4 columns, in every cell being an editable / computed field. You can imagine what kind of formulas we entered in each field, considering the fact that the current fields row were based on the value of the previous fields row and so on.

在 xpages 中,我的方案是创建一个按钮,显示发票结构所在的对话框.完成所有字段,然后保存/隐藏对话框、文档.<发票 > 将列在主文档内的(嵌入式)视图中.当前打开的对话框/发票将考虑以前的发票值.显然,会有一些缺点,我首先注意到的是:假设我的视图列出了 5 张发票.如果我打开编辑第二个,我修改一些字段 => 从第三个到最后一个,最后一次编辑会改变吗?

In xpages, my scenario was to create a button which shows a dialog where the invoice structure is. Completing all the fields and then save/hide the dialog, the doc. < invoice > will be listed on an (embedded) view inside the main document. the current opened dialog / invoice will take consideration on the previous invoice values. Obviously, there would be some disadvantages, the first I noticed was: let say my view lists 5 invoices. If I open for editing the 2nd one, I modify some field => from the 3rd to the last one, will be all be changing on this last edit?

是否有任何我可以从中获得启发的示例片段或此类计算的简单模块?

Is there any sample snippet from I could get inspired or a simple module of this type ofcalculations?

我想要一些建议和一些有用的提示/建议.此外,我将感谢任何我应该提防的重要考虑因素.

I would like some advices and some helpful tips/suggestions. Also, I will appreciate any important considerations that I should be beware of.

推荐答案

这是 XPage 和重复控件优势的主要示例.

This is a prime example of where XPages and a repeat control is of benefit.

在旧的 Notes 表单上,您会添加 24 行 4 列.想想如果有人需要创建 25 张发票,或者计算/隐藏时对一列错误或需要另一列所涉及的开销.

On the old Notes form, you'd have added 24 rows of 4 columns. Think of the overhead involved if someone then needs to create 25 invoices, or the calculation/hide-when is wrong for one column, or another column is required.

重复控件允许您构建一个布局实例并动态迭代 2、20、200 行.您可以使用对话框,或者通过一个按钮将相关键(文档的 UNID,如果您正在构建 Java 对象的映射的键)添加到作用域变量,从而使行可编辑/不可编辑;如果 viewScope 变量是当前行的键,则字段是可编辑的,否则不可编辑.

Repeat controls allow you to build one instance of the layout and iterate over 2, 20, 200 rows dynamically. You can use a dialog, or make a row editable/non-editable by having a button that adds the relevant key (a UNID for a document, a key if you're building a Map of Java objects) to a scoped variable; then the fields are editable if the viewScope variable is the key for the current row, otherwise not.

添加其他行很简单 - 更改行值或添加页面.添加一个额外的列很容易 - 做一次,它就完成了.每行没有隐藏时间公式,所以那里没有错误的机会.计算指向该行的数据,而不是包含_1"、_2"、_3"等的字段.如果计算需要更改,请执行一次,并针对所有行执行.

Adding additional rows is simple - change the rows value or add a page. Adding an additional column is easy - do it once and it's done for all. There are no hide-when formulas for each row, so no chance of mistakes there. Calculations point to the data for that row, not a field with "_1", "_2", "_3" etc. If a calculation needs changing, do it once and it's done for all rows.

这篇关于Xpages 如何获取/创建这个计算模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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