Lotus 视图列与字符串/整数进行比较

发布于 2024-08-29 05:14:34 字数 341 浏览 1 评论 0原文

我有一个存储数字的莲花视图。我需要对值执行一些数学运算,但在使类型匹配方面遇到很多问题。

doc.numOfGold = numGold 

CInt(doc.numOfGold) = numGold

CInt(doc.numOfGold) = CInt(numGold)

doc.numOfGold = CInt(numGold) >

所有返回类型不匹配。我尝试更改列属性以将其视为小数,但运气不佳。

有什么想法吗?

谢谢!

I have a lotus view that stores a number. I need to perform some math against the value, but I am having a lot of problems getting the types to match up.

doc.numOfGold = numGold 

and CInt(doc.numOfGold) = numGold

and CInt(doc.numOfGold) = CInt(numGold)

and doc.numOfGold = CInt(numGold)

all return type mismatch. I've tried changing the column properties to treat it as a decimal, with no better luck.

Any thoughts?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

裂开嘴轻声笑有多痛 2024-09-05 05:14:34

切勿访问这样的字段:“doc.fieldname”。用户 doc.GetItemValue("fieldname")(0),这将返回正确的类型。

如果 doc.numOfGold 是一个数字字段,而 numGold 是一个 int,它应该像这样工作:

Dim numOfGold as integer
numOfGold = doc.GetItemValue("numOfGold")(0)

如果 doc.numOfGold 是一个文本字段,则必须进行转换,例如 val(doc.GetItemValue("numOfGold")( 0))

还要验证您的字段值不是空字符串,例如使用字段验证公式。

Never access a field like this: "doc.fieldname". User doc.GetItemValue("fieldname")(0), this returns the correct type.

If doc.numOfGold is a numberfield, and numGold is an int, it should work like this:

Dim numOfGold as integer
numOfGold = doc.GetItemValue("numOfGold")(0)

if doc.numOfGold is a textfield, you have to do a conversion, e.g. val(doc.GetItemValue("numOfGold")(0))

Also verify that your field value is not an empty string, e.g. use a field validation formula.

伴我老 2024-09-05 05:14:34

永远不要访问这样的字段:
“文档.字段名称”。

有点苛刻,访问文档字段值是完全可以接受的:

x = doc.FieldName(0)

Doc.FieldName = ScalarValue

甚至

Doc.FieldName = ArrayOfValues

为了确保成功,您可能需要查看是否 'Doc.HasItem(" FieldName")' 首先(对于 getFirstItem 也是如此)。

注意:GetFirstItem 是获取字段值的直接方法,以获得最大性能:

x = doc.getFirstItem("FieldName").Values(0)

因为这避免了“默认属性”。

此外,错误报告/语法检查可以“忽略”“假定的默认值”“doc.FieldName(0)”

Never access a field like this:
"doc.fieldname".

Bit harsh, accessing a document field value is perfectably acceptable:

x = doc.FieldName(0)

Doc.FieldName = ScalarValue

or even

Doc.FieldName = ArrayOfValues

To be sure of success, you may want to see if 'Doc.HasItem("FieldName")' first (true for getFirstItem too).

NB: GetFirstItem is the direct way to get the field value, for max performance:

x = doc.getFirstItem("FieldName").Values(0)

As this avoids 'default properties'.

Also, the 'assumed default' 'doc.FieldName(0)' can be 'overlooked' by error reporting/syntax checking

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文