Chinaunix首页 | 论坛 | 博客
  • 博客访问: 497030
  • 博文数量: 105
  • 博客积分: 2922
  • 博客等级: 少校
  • 技术积分: 1113
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-02 16:30
文章分类

全部博文(105)

文章存档

2018年(1)

2016年(2)

2015年(3)

2014年(6)

2013年(21)

2012年(10)

2011年(8)

2010年(7)

2009年(31)

2008年(16)

我的朋友

分类:

2010-08-20 11:22:21

Sort, Filter and Query Dialogs
The datawindow is the work horse of PowerBuilder, when you have been using it for a while it is easy to forget some of the basic but very powerful built-in function of the Datawindow.

Sort

You can specify the default sort sequence of the datawindow using a cool drag and drop style response window, but you may not know that with two or three simple commands you can offer the same dialog window to users of your application:

String ls_Null

SetNull( ls_Null )
dw_1.SetSort( ls_Null )
dw_1.Sort()

Filter

The filter is a great function for showing users slices of the data making the screen less cluttered and making large amounts of data easier to deal with. Well the filter dialog window is also available to your users:

String ls_Null

SetNull( ls_Null )
dw_1.SetFilter( ls_Null )
dw_1.Filter()

Query Mode

Query mode is a great feature for higher power users. It allows them to alter the where clause by entering arguments into the Datawindow columns. For example whilst in query mode the user could enter >500 to show all employees who's hourly rate was over 500 dollars. And if there are any companies out there who want to pay me 500 dollars an hour send me an email :). Anyway enough fantasy, the user only extends the original where clause so you can add a few basic joins and limits to the SQL to they don't bring the server down. You can also query the Where clause so see what they altered it to and maybe offer some ability to save their queries for future use. This code is based in the clicked event of a checkbox to allow the user to toggle the query mode:

IF NOT this.checked THEN
   dw_1.Modify("DataWindow.QueryMode=YES")
ELSE
    dw_1.Modify("DataWindow.QueryMode=NO")
    dw_1.Retrieve()
END IF
阅读(1254) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~