如何才能动态的创建一个分组

zm1313 2004-12-08 10:19:28
我想动态的创建一个分组,请问如何来写
分组条件怎样设成一个或多计算列或列
...全文
119 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zm1313 2004-12-09
  • 打赏
  • 举报
回复
我的数据窗口是先create好的了,然后在其基础上进行modify
创建计算列,然后用计算列分组
braversmmu 2004-12-09
  • 打赏
  • 举报
回复
ls_group_column = "emp_data.emp_salary"
braversmmu 2004-12-09
  • 打赏
  • 举报
回复
你只要改变ls_group_column即可。 如ls_group_column = emp_data.emp_salary等等
braversmmu 2004-12-09
  • 打赏
  • 举报
回复
你的问题的实质是动态创建分组的数据窗口,可以先参考动态数据窗口的创建方法,然后在你的sql语句中加入group即可。
string ERRORS, sql_syntax

string presentation_str, dwsyntax_str

string ls_group_column //分组条件
sql_syntax = "SELECT emp_data.emp_id,"&

+ "emp_data.emp_name FROM emp_data "&

+ "WHERE emp_data.emp_salary > 45000"&

+ "group by " + ls_group_column

presentation_str = "style(type=grid)"

dwsyntax_str = SQLCA.SyntaxFromSQL(sql_syntax, &

presentation_str, ERRORS)

IF Len(ERRORS) > 0 THEN

MessageBox("Caution", &

"SyntaxFromSQL caused these errors: " + ERRORS)

RETURN

END IF

dw_1.Create( dwsyntax_str, ERRORS)

IF Len(ERRORS) > 0 THEN

MessageBox("Caution", &

"Create cause these errors: " + ERRORS)

RETURN

END IF
workhand 2004-12-09
  • 打赏
  • 举报
回复
Ls_sytax1 = Ls_sytax + ' group(level=' + string(st_dwfilterfind.st_num) + ' header.height=0 trailer.height=80 by=("' + trim(st_dwfilterfind.st_value) + '" ) header.color="536870912" trailer.color="536870912" ' + Ls_sort + ' ) &
compute(band=trailer.'+string(st_dwfilterfind.st_num)+' alignment="1" expression="sum(' + trim(Ls_dwoname) + ' for group '+string(st_dwfilterfind.st_num)+')"border="0" color="0" x="'+Ls_x+'" y="8" height="56" width="'+Ls_width+'" format="###,###,###,###.00" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="16777215" ) &
text(band=trailer.'+string(st_dwfilterfind.st_num)+' alignment="2" text="小计"border="0" color="0" x="'+Ls_x1+'" y="12" height="56" width="'+Ls_width1+'" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" ) &
text(band=summary alignment="2" text="合计"border="0" color="0" x="'+Ls_x1+'" y="8" height="56" width="'+Ls_width1+'" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" ) &
compute(band=summary alignment="1" expression="sum('+trim(Ls_dwoname)+' for all)"border="0" color="0" x="'+Ls_x+'" y="16" height="56" width="'+Ls_width+'" format="###,###,###,###.00" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" ) '
This.Create(Ls_sytax1,s_error)
This.SetTransObject(SQLCA)
取好各个参数应该就可以的。
hygougou 2004-12-09
  • 打赏
  • 举报
回复
如果你用的9(8好象也有,用过几次,不多,没注意),new一下,在最后一页tool里面选择datawindow syntax查看语法帮助,或者找个分好组的数据窗口edit source看看代码,6以下的export,然后用记事本打开也可以看到对象构造的代码

1,079

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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