查看 2 列总计之间的 XPage 比率 [英] XPages ratio between 2 column totals in view

查看:24
本文介绍了查看 2 列总计之间的 XPage 比率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 2 列的视图.两种数字类型.我想在页面上添加一个按钮,该按钮将计算第 1 列的总数和第 2 列的总数之间的比率.

I have a view with 2 columns. Both number types. I want to add a button to the page, which will calculate the ration between total of column 1 and total of column 2.

For example:
Column 1 | Column 2
5        | 5
10       | 10
4        | 3
3        | 4
It should be (5+10+4+3)/(5+10+3+4) = 1..

谢谢,

弗洛林

推荐答案

我可能会进入视图属性并打开这两列的总计.然后在 SSJS 中,我会为该视图获取一个 NotesNavigator,然后创建一个 NotesViewEntry 对象.然后我将该 ViewEntry 设置为 NotesNavigator.getLastEntry()...类似的东西.该条目应该有一个 columnValues() 属性.我认为它会是这样的:

I would probably go into the view properties and turn on the totals for both those columns. Then in SSJS I'd get a NotesNavigator for that view and then create a NotesViewEntry object. Then I'd set that ViewEntry to the NotesNavigator.getLastEntry()... something like that. That entry should then have a columnValues() property. I THINK it would be something like:

var column1 = entry.getColumnValues()[1];
var column2 = entry.getColumnValues()[2];

注意:getColumnValues() 是从零开始的,并且根据视图设计,某些列可能无法从 getColumnValues() 中检索.

Note: getColumnValues() is zero based and depending on the view design some columns might not be available to retrieve from getColumnValues().

一旦你有 2 个变量,你就可以进行数学运算并对结果做任何事情.

Once you have you're 2 var's then you can do the math and do whatever with the result.

至少我会这样做.

(我手边没有编辑器所以很抱歉如果某些语法被关闭)

(I don't have an editor handy so sorry if some of the syntax is off)

这篇关于查看 2 列总计之间的 XPage 比率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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