数据窗口计算列的不正常显示,该如何解决啊,非常急得说,在线等候!!

damao5755 2003-06-01 04:40:59
我用tabular风格画了一个数据窗口,并做了分组统计。
其中所有列进行了分组汇总:sum(c_guard for group 1),
最后进行了总计:sum(c_guard for all)。

其中有些列sum出来后得不到正确的值,比如本来应该是
0.31+0.12+0.31=0.74 可是那个计算字段内是:0.7400000002这样的数
以至于显示时候字段宽度不够,成了一连串的“0”。

这种情况的出现似乎没有什么规律:
1.只出现在总计部分:sum(c_guard for all);
2.添加若干数据重新汇总时,有可能在别的列出现。

哪位见过此类问题,烦请告知解决办法。
...全文
47 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
逢桥夜泊 2003-06-01
  • 打赏
  • 举报
回复
这是什么呀?
homeness 2003-06-01
  • 打赏
  • 举报
回复
怎么这么多啊
round可以
truncate也可以
joss 2003-06-01
  • 打赏
  • 举报
回复
font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"成都~",city_num,0) for all)"border="0" color="0" x="878" y="8" height="56" width="224" format="[GENERAL]" name=compute_14 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"乐山~",city_num,0) for all)"border="0" color="0" x="1134" y="8" height="56" width="224" format="[GENERAL]" name=compute_15 slideup=directlyabove font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"自贡~",city_num,0) for all)"border="0" color="0" x="1390" y="8" height="56" width="224" format="[GENERAL]" name=compute_16 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"昆明~",city_num,0) for all)"border="0" color="0" x="1646" y="8" height="56" width="224" format="[GENERAL]" name=compute_17 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"大理~",city_num,0) for all)"border="0" color="0" x="1902" y="8" height="56" width="224" format="[GENERAL]" name=compute_18 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=summary alignment="1" expression="sum(if (city_name=~"西双版纳~",city_num,0) for all)"border="0" color="0" x="2158" y="8" height="56" width="224" format="[GENERAL]" name=compute_19 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
line(band=summary x1="603" y1="0" x2="603" y2="92" name=l_50 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="37" y1="72" x2="2395" y2="72" name=l_7 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
text(band=summary alignment="2" text="总计" border="0" color="0" x="201" y="12" height="56" width="110" name=t_13 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
line(band=foreground x1="37" y1="268" x2="37" y2="448" name=l_8 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="603" y1="268" x2="603" y2="448" name=l_5 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="859" y1="268" x2="859" y2="448" name=l_9 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="1627" y1="268" x2="1627" y2="448" name=l_10 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="2395" y1="268" x2="2395" y2="448" name=l_11 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="1883" y1="352" x2="1883" y2="448" name=l_12 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="2139" y1="352" x2="2139" y2="448" name=l_15 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="1115" y1="352" x2="1115" y2="448" name=l_13 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=foreground x1="1371" y1="352" x2="1371" y2="448" name=l_14 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" )
skylineman 2003-06-01
  • 打赏
  • 举报
回复
用format设置格式也可以的
skylineman 2003-06-01
  • 打赏
  • 举报
回复
5656
joss 2003-06-01
  • 打赏
  • 举报
回复
compute(band=header.2 alignment="0" expression="if (compute_22 = 1,'',tran_name)"border="0" color="16711680" x="306" y="8" height="56" width="215" format="[GENERAL]" name=compute_23 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
line(band=header.2 x1="192" y1="0" x2="192" y2="92" name=l_54 visible="1~tif( type_count >1,1,0)" pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"乐山~",city_num,0) for group 1)"border="0" color="0" x="1134" y="4" height="56" width="224" format="[GENERAL]" name=compute_2 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="0" expression=" compute_1 + compute_2 + compute_3 + compute_4 + compute_5 + compute_6 "border="0" color="0" x="622" y="4" height="56" width="224" format="[GENERAL]" name=compute_21 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"成都~",city_num,0) for group 1)"border="0" color="0" x="878" y="4" height="56" width="224" format="[GENERAL]" name=compute_1 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="603" y1="0" x2="603" y2="92" name=l_21 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"自贡~",city_num,0) for group 1)"border="0" color="0" x="1390" y="4" height="56" width="224" format="[GENERAL]" name=compute_3 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"昆明~",city_num,0) for group 1)"border="0" color="0" x="1646" y="4" height="56" width="224" format="[GENERAL]" name=compute_4 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"大理~",city_num,0) for group 1)"border="0" color="0" x="1902" y="4" height="56" width="224" format="[GENERAL]" name=compute_5 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="1" expression="sum(if (city_name=~"西双版纳~",city_num,0) for group 1)"border="0" color="0" x="2158" y="4" height="56" width="224" format="[GENERAL]" name=compute_6 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="859" y1="0" x2="859" y2="92" name=l_22 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="1115" y1="0" x2="1115" y2="92" name=l_23 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="1371" y1="0" x2="1371" y2="92" name=l_25 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="1627" y1="0" x2="1627" y2="92" name=l_24 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="1883" y1="0" x2="1883" y2="92" name=l_27 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="2139" y1="0" x2="2139" y2="92" name=l_26 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="2395" y1="0" x2="2395" y2="92" name=l_28 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="603" y1="68" x2="2395" y2="68" name=l_3 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="37" y1="68" x2="608" y2="68" name=l_51 pen.style="0" pen.width="5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="37" y1="0" x2="37" y2="92" name=l_53 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=trailer.1 x1="192" y1="0" x2="192" y2="92" name=l_55 visible="1~tif( type_count >1,1,0)" pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
compute(band=trailer.1 alignment="0" expression="case (type_count
when 1 then tran_type
else '小计')"border="0" color="0" x="311" y="4" height="56" width="215" format="[GENERAL]" name=compute_24 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
line(band=summary x1="37" y1="0" x2="37" y2="92" name=l_19 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_36 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_37 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_38 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_39 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_40 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_41 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="27" y1="0" x2="27" y2="0" name=l_42 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="859" y1="0" x2="859" y2="92" name=l_43 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="1115" y1="0" x2="1115" y2="92" name=l_44 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="1371" y1="0" x2="1371" y2="92" name=l_45 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="1627" y1="0" x2="1627" y2="92" name=l_46 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=summary x1="1883" y1="0" x2="1883" y2="92" name=l_47 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
joss 2003-06-01
  • 打赏
  • 举报
回复
text(band=header alignment="2" text="大理" border="0" color="0" x="1902" y="368" height="56" width="224" name=t_5 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="西双版纳" border="0" color="0" x="2158" y="368" height="56" width="224" name=t_6 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
line(band=header x1="864" y1="348" x2="2400" y2="348" name=l_4 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header x1="37" y1="264" x2="599" y2="436" name=l_16 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
text(band=header alignment="2" text="地区" border="0" color="0" x="430" y="292" height="56" width="110" name=t_12 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
line(band=header x1="37" y1="264" x2="2400" y2="264" name=l_1 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header x1="37" y1="440" x2="2395" y2="440" name=l_2 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
compute(band=header alignment="0" expression="count (tran_name for group 1 DISTINCT)"border="0" color="16711680" x="1915" y="8" height="56" width="215" format="[GENERAL]" name=compute_22 visible="1~t0" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
compute(band=header alignment="0" expression="count (tran_name for group 1 DISTINCT)"border="0" color="16711680" x="2185" y="12" height="56" width="215" format="[GENERAL]" name=type_count visible="1~t0" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
compute(band=header alignment="0" expression="max(type_count)"border="0" color="0" x="1614" y="12" height="76" width="256" format="[GENERAL]" name=max_type visible="1~t0" font.face="Arial" font.height="-12" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" )
compute(band=header.2 alignment="0" expression=" compute_7 + compute_8 + compute_9 + compute_10 + compute_11 + compute_12 "border="0" color="0" x="622" y="8" height="56" width="224" format="[GENERAL]" name=compute_13 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"成都~",city_num,0) for group 2)"border="0" color="0" x="878" y="8" height="56" width="224" format="[GENERAL]" name=compute_7 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"乐山~",city_num,0) for group 2 )"border="0" color="0" x="1134" y="8" height="56" width="224" format="[GENERAL]" name=compute_8 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"自贡~",city_num,0) for group 2)"border="0" color="0" x="1390" y="8" height="56" width="224" format="[GENERAL]" name=compute_9 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"昆明~",city_num,0) for group 2)"border="0" color="0" x="1646" y="8" height="56" width="224" format="[GENERAL]" name=compute_10 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"大理~",city_num,0) for group 2)"border="0" color="0" x="1902" y="8" height="56" width="224" format="[GENERAL]" name=compute_11 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
compute(band=header.2 alignment="1" expression="sum(if (city_name=~"西双版纳~",city_num,0) for group 2)"border="0" color="0" x="2158" y="8" height="56" width="224" format="[GENERAL]" name=compute_12 visible="1~tif (compute_22 > 1,1,0)" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
line(band=header.2 x1="37" y1="0" x2="37" y2="92" name=l_18 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="603" y1="72" x2="2400" y2="72" name=l_6 visible="1~tif (compute_22 > 1,1,0)" pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="603" y1="0" x2="603" y2="92" name=l_20 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="859" y1="0" x2="859" y2="92" name=l_29 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="1115" y1="0" x2="1115" y2="92" name=l_30 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="1371" y1="0" x2="1371" y2="92" name=l_31 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="1627" y1="0" x2="1627" y2="92" name=l_32 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="1883" y1="0" x2="1883" y2="92" name=l_33 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="2139" y1="0" x2="2139" y2="92" name=l_34 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="2395" y1="0" x2="2395" y2="92" name=l_35 pen.style="0" pen.width="5~t0.5" pen.color="8421504" background.mode="2" background.color="16777215" )
line(band=header.2 x1="197" y1="72" x2="603" y2="72" name=l_52 visible="1~tif (compute_22 > 1,1,0)" pen.style="0" pen.width="5" pen.color="8421504" background.mode="2" background.color="16777215" )

joss 2003-06-01
  • 打赏
  • 举报
回复
楼主最后这样写就可以了!
关于SUM的用法,可以将下面内容导入到你的实例中去,是一个数据窗口,可以好好参考一下!
$PBExportHeader$d_test.srd
release 7;
datawindow(units=0 timer_interval=0 color=16777215 processing=0 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no )
header(height=444 color="536870912" )
summary(height=76 color="536870912" )
footer(height=0 color="536870912" )
detail(height=0 color="536870912" )
table(column=(type=char(10) updatewhereclause=no name=tran_name dbname="tran_name" )
column=(type=char(10) updatewhereclause=no name=city_group dbname="city_group" )
column=(type=char(10) updatewhereclause=no name=city_name dbname="city_name" )
column=(type=number updatewhereclause=no name=city_num dbname="city_num" )
column=(type=char(10) updatewhereclause=no name=tran_type dbname="tran_type" )
)
data("大巴", "四川", "成都", 2, "公路", "大巴", "四川", "成都", 3, "公路", "大巴", "四川", "乐山", 34, "公路", "大巴", "四川", "乐山", 567, "公路", "大巴", "四川", "自贡", 88, "公路", "大巴", "四川", "自贡", 99, "公路", "大巴", "云南", "昆明", 45, "公路", "大巴", "云南", "昆明", 34, "公路", "大巴", "云南", "大理", 213, "公路", "大巴", "云南", "大理", 5, "公路", "大巴", "云南", "西双版纳", 6, "公路", "大巴", "云南", "西双版纳", 456, "公路", "中巴", "四川", "成都", 23, "公路", "中巴", "四川", "成都", 123, "公路", "中巴", "四川", "乐山", 6, "公路", "中巴", "四川", "乐山", 677, "公路", "中巴", "四川", "自贡", 88, "公路", "中巴", "四川", "自贡", 345, "公路", "中巴", "云南", "昆明", 23, "公路", "中巴", "云南", "昆明", 54, "公路", "中巴", "云南", "大理", 546, "公路", "中巴", "云南", "大理", 657, "公路", "中巴", "云南", "西双版纳", 234, "公路", "中巴", "云南", "西双版纳", 123, "公路", "小车", "四川", "成都", 324, "公路", "小车", "四川", "成都", 65, "公路", "小车", "四川", "乐山", 7, "公路", "小车", "四川", "乐山", 345, "公路", "小车", "四川", "自贡", 123, "公路", "小车", "四川", "自贡", 44, "公路", "小车", "云南", "昆明", 55, "公路", "小车", "云南", "昆明", 634, "公路", "小车", "云南", "大理", 2134, "公路", "小车", "云南", "大理", 654, "公路", "小车", "云南", "西双版纳", 234, "公路", "轿车", "云南", "西双版纳", 23, "公路", "铁路", "四川", "成都", 33, "铁路", "铁路", "四川", "成都", 12, "铁路", "铁路", "四川", "乐山", 44, "铁路", "铁路", "四川", "乐山", 44, "铁路", "铁路", "四川", "自贡", 55, "铁路", "铁路", "四川", "自贡", 123, "铁路", "铁路", "云南", "昆明", 3432, "铁路", "铁路", "云南", "昆明", 67, "铁路", "铁路", "云南", "大理", 78, "铁路", "铁路", "云南", "大理", 24, "铁路", "铁路", "云南", "西双版纳", 54, "铁路", "铁路", "云南", "西双版纳", 90, "铁路", "航空", "四川", "成都", 345, "航空", "航空", "四川", "成都", 12, "航空", "航空", "四川", "乐山", 34, "航空", "航空", "四川", "乐山", 3454, "航空", "航空", "四川", "自贡", 56, "航空", "航空", "四川", "自贡", 6, "航空", "航空", "云南", "昆明", 23, "航空", "航空", "云南", "昆明", 21, "航空", "航空", "云南", "大理", 34, "航空", "航空", "云南", "大理", 6, "航空", "航空", "云南", "西双版纳", 77, "航空", "航空", "云南", "西双版纳", 45, "航空", )
group(level=1 header.height=0 trailer.height=72 by=("tran_type" ) header.color="536870912" trailer.color="536870912" )
group(level=2 header.height=80 trailer.height=0 by=("tran_name" ) header.color="536870912" trailer.color="536870912" )
text(band=background alignment="2" text="~tcase ( max_type
when 1 then '公路'
when 2 then '公~~r路'
when 3 then '公路~~r~~r'
when 4 then '~~r公路~~r'
else fill('~~r',ceiling((max(type_count) -2) /2)) + '公~~r路'+fill('~~r',ceiling((max(type_count) -2) /2))
)" border="0" color="0" x="82" y="512" height="180~tmax(type_count) * 72" width="69" name=t_14 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="553648127" )
text(band=header alignment="2" text="类别" border="0" color="0" x="91" y="364" height="56" width="110" name=t_10 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="四川" border="0" color="0" x="1125" y="280" height="56" width="224" name=t_7 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="云南" border="0" color="0" x="1902" y="276" height="56" width="224" name=t_8 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="西南地区客运能力统计表" border="0" color="0" x="27" y="84" height="124" width="2386" name=t_11 font.face="宋体" font.height="-20" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="合计" border="0" color="0" x="622" y="328" height="56" width="224" name=t_9 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="成都" border="0" color="0" x="878" y="368" height="56" width="224" name=t_1 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="乐山" border="0" color="0" x="1134" y="368" height="56" width="224" name=t_2 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="自贡" border="0" color="0" x="1390" y="368" height="56" width="224" name=t_3 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="昆明" border="0" color="0" x="1646" y="368" height="56" width="224" name=t_4 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )

damao5755 2003-06-01
  • 打赏
  • 举报
回复
多谢你的详细解答,理论的问题是搞清楚了。
鉴于我这种汇总的情况,具体怎么解决呢?

1.整数类型列的汇总:round(sum(c_整数列 for all),0)
2.原来是2位小数的列的汇总:round(sum(c_两位小数列 for all),2)
3.汇总完毕的 compute_1 = round(sum(c_两位小数列1 for all),2)
compute_2 = round(sum(c_两位小数列2 for all),2)
那么 compute_3 = compute_1 + compute_2
也是不是需要round 如这样:compute_3 = round(compute_1 + compute_2,2)

不知按你说的方法,用以上办法解决对不对头?
waterstony 2003-06-01
  • 打赏
  • 举报
回复
sorry,是这样:

数值类型,都会先进行类型转换升级,进行算术操作后,然后再转化成目标类型

1、+, -, *操作符的返回值最少是long的,所以,即使是两个int相加减乘都得先化为long操作,至于有其他优先状况,遵从数值型优先规律。

2、/ and ^操作符的返回值是double的!所有类型都先转换为double再进行这两个操作。

sum相当于+,返回类型就是列类型

数值型变量的优先级:
Double
Real
Decimal
UnsignedLong
Long
UnsignedInteger
Integer
damao5755 2003-06-01
  • 打赏
  • 举报
回复
那是不是所有数值型的sum完毕后都需要round一下,
比如整数的话,就round(c_guard for group 1),0)
要不都有可能不正常,是吗?
waterstony 2003-06-01
  • 打赏
  • 举报
回复
不是bug,pb中所有的算术操作都会提升到dec数据类型操作,只要是数值类型,都会先转换成dec型进行算术操作,然后再转化成目标类型
damao5755 2003-06-01
  • 打赏
  • 举报
回复
给个sum后都round一下吗?
可是实际上sum之前的数字确实都是两位小数,
怎么也不可能是0.7400000002这样的数字啊。
是不是PB的bug啊?
对了,我用的D版8.0.
killerdanny 2003-06-01
  • 打赏
  • 举报
回复
dw_1.GroupCalc()
waterstony 2003-06-01
  • 打赏
  • 举报
回复
这样就可以了
round(sum(c_guard for group 1),2)

611

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧