在 Lotus Notes 中根据具有数值的文本字段对视图进行排序时出现问题
现有的 Lotus Notes 数据库表单有一个包含数值的文本字段。我正在尝试创建一个视图来对此字段进行排序,但结果如下
99 1000 1002 1003 101 1011
有没有办法转换字段以便我可以按数字排序。莲花笔记 6.5。
An existing Lotus Notes database form has a text field whic contains a numeric value. I am trying create a view to sort on this field but the result is coming up as follows
99
1000
1002
1003
101
1011
Is there any way to convert the field so I can sort numerically. Lotus Notes 6.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在列公式中,使用以下命令将您的项目转换为数字
In the column formula, convert your item to a number using
由于文本字段具有数值,因此它们仍被视为文字字符串。因此,我发现格式化它们并避免@Errors'的最简单方法是用前导零填充它们并继续将它们视为字符串。
这个解决方案的好处是我们仍在处理字符串。无需考虑数据类型转换,因为您可能拥有无法转换为数字的数据。
因此,将其放入列公式中,并根据需要将排序选项设置为升序或降序:
确保“MaxSize”值大于其接收的任何值的长度。从您提供的示例来看,4 看起来可以解决问题。
(根据 Ken 的建议),如果填充列的外观对用户没有吸引力,您可以将此列设置为隐藏的已排序列,然后向用户呈现原始的未格式化(和未排序)列,以便它显示在数字顺序。
Because the text field has numeric values, they are still treated as literal string. So, the easiest way I have found to format them and avoiding @Errors' is to pad them with leading zeroes as well and continue to treat them as a string.
The good thing about this solution is that we're still dealing with strings. No mucking about with data type conversions where you may have data that cannot be converted into a number.
So put this into your column formula and set the sorting options as ascending or descending as you require:
Make sure that your "MaxSize" value is greater than the length of any value it receives. From the sample you've provided, 4 looks like it will do the trick.
(As per Ken's suggestion), if the appearance of the padded column to the user is not appealing, you can make this column a hidden, sorted column and then present the original unformatted (and unsorted) column to the user so it appears in a numerical order.