有视图列出了一定数量的文档,其中包含视图选择表单。列(Style = Date/Time
显示Time
)的公式为:time_1
。下一栏显示:time_2
。
换句话说:
time_1
- 用户上班的时间。
time_2
- 用户必须上班的时间(比如说08:00)。
有一个视图操作按钮:
t1:=@DbColumn("Notes":"NoCache";"server/Company":"Name.nsf";"vwSearchResult";6);
total1:= @Sum(@ToNumber(t1)) ;
t2:=@DbColumn("Notes":"NoCache";"server/Company":"Name.nsf";"vwSearchResult";7);
total2:= @Sum(@ToNumber(t2)) ;
zile:=(total1-total2)/8; // 8 - is the minimun number of hours / day. " I must be at work minimum 8 hours "
@Prompt([Ok];"Time at work";@Text(total1));
@Prompt([Ok];"expected time";@Text(total2));
@Prompt([Ok];"Additional time - in days ";@Text(zile))
正确计算第二个提示。第一个提示结果是一个整数,当然,隐含地第三个提示没有正确显示结果。
我怎样才能做到这一点?
答案 0 :(得分:4)
将公式更改为
t1:=@DbColumn("Notes":"NoCache";"server/Company":"Name.nsf";"vwSearchResult";6);
total1:= @Sum(t1 - [00:00]) / 3600;
t2:=@DbColumn("Notes":"NoCache";"server/Company":"Name.nsf";"vwSearchResult";7);
total2:= @Sum(t2 - [00:00]) / 3600;
您无法使用@ToNumber将时间值转换为数字。而是计算您的时间和00:00之间的差异。这为您提供了您的时间秒数。
将此除以3600,即可获得时间。
答案 1 :(得分:0)
我认为最好在视图中插入一列来计算time_1和time_2之间的差异。
你的@DbColum现在将在新列上运行并计算差异。