***如何得到DW里分组数据***

xingjiaren 2002-10-19 11:50:04
DW按某列分组,检索出的数据里有若干个组,
现在想分别得到每个组的计算列的值,
如何写代码或者用哪些函数?
...全文
84 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
WorldMobile 2002-10-19
  • 打赏
  • 举报
回复
看看吧,有什么问题给我发短消息
WorldMobile 2002-10-19
  • 打赏
  • 举报
回复
举个例子,你是按oper_name来分组,取money(为计算列)
数据窗口为dw_main

long ll_row, ll_cnt, ll_group_no
dec{2} ldc_money[]
ll_group_no = 0
ll_cnt = dw_main.rowcount()
for ll_row = 1 to ll_cnt
if dw_main.describe("evaluate('if(oper_name = oper_name[1], 1, 0)', " + string(ll_row) + ")") = '1' then
ll_group_no ++
ldc_money[ll_group_no] = dec(dw_main.describe("evaluate('sum(money for group 1), " + string(ll_row) + ")"))
end if
next

ldc_money中就是你想要的数据
WorldMobile 2002-10-19
  • 打赏
  • 举报
回复
不好办,不过还是有办法的,可能有些麻烦,我帮你写个看看
balloonman2002 2002-10-19
  • 打赏
  • 举报
回复
long row = 1 //初始化第一组的第一行
real sumamount
IF dw_1.RowCount() = 0 THEN row = 0
DO WHILE row > 0
sumamount = dw_1.Object.amounts[row] //取此组的组小计带的值
...... //对取得的值进行相应的处理
//上面amounts是"在Trailer Group 1"带中,表达式如SUM(je for group 1)
row = dw_1.FindGroupChange(row + 1, 1) //取得下一组的第一行
LOOP //如果不是最后一组,则继续
Wiley, Data Warehousing for Dummies (Wiley 2009.2.ed).pdf ------------------ Part I: The Data Warehouse: Home for Your Data Assets ...7 Chapter 1: What’s in a Data Warehouse? ........................................................................9 Chapter 2: What Should You Expect from Your Data Warehouse? ...........................25 Chapter 3: Have It Your Way: The Structure of a Data Warehouse ...........................37 Chapter 4: Data Marts: Your Retail Data Outlet ...........................................................59 Part II: Data Warehousing Technology ........................ 71 Chapter 5: Relational Databases and Data Warehousing ...........................................73 Chapter 6: Specialty Databases and Data Warehousing .............................................85 Chapter 7: Stuck in the Middle with You: Data Warehousing Middleware ..............95 Part III: Business Intelligence and Data Warehousing ...113 Chapter 8: An Intelligent Look at Business Intelligence............................................115 Chapter 9: Simple Database Querying and Reporting ..............................................125 Chapter 10: Business Analysis (OLAP) .......................................................................135 Chapter 11: Data Mining: Hi-Ho, Hi-Ho, It’s Off to Mine We Go ................................149 Chapter 12: Dashboards and Scorecards ...................................................................155 Part IV: Data Warehousing Projects: How to Do Them Right ............................................. 163 Chapter 13: Data Warehousing and Other IT Projects: The Same but Different ...165 Chapter 14: Building a Winning Data Warehousing Project Team ..........................179 Chapter 15: You Need What? When? — Capturing Requirements ..........................193 Chapter 16: Analyzing Data Sources............................................................................203 Chapter 17: Delivering the Goods ................................................................................213 Chapter 18: User Testing, Feedback, and Acceptance ..............................................225 Part V: Data Warehousing: The Big Picture ................ 231 Chapter 19: The Information Value Chain: Connecting Internal and External Data .....................................................................233 Chapter 20: Data Warehousing Driving Quality and Integration .............................247 Chapter 21: The View from the Executive Boardroom .............................................263

611

社区成员

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

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