您的位置:首页 > 产品设计 > UI/UE

使用Powerbuilder中数据窗口表达式访问数据

2005-08-27 15:58 423 查看
1、从数组到数据窗口到数组
This example resets the emp_name value in rows 11 through 20 to an empty string. Rows 12 to 20 are set to a default value, which may be an empty string:
string ls_empty[]
ls_empty[1] = ""
dw_1.Object.emp_name[11,20] = &
{"","","","","","","","","",""}

This statement gets the original emp_name values in rows 11 to 20 and assigns them to elements 1 to 10 in an array of strings:
string ls_namearray[]
ls_namearray = dw_1.Object.emp_name.Original[11,20]

2、从数据窗口将数据拷贝到另一数据窗口
This example replaces all the data in the nested report in row 2 with data from dw_2. The columns in the DataWindow object in dw_2 must match the columns in the DataWindow object for the nested report:
dw_1.Object.NestRep[2].Object.Data = &
dw_2.Object.Data
3、将删除缓冲区中的数据放到到文件中
This example gets employee IDs and last names for all the rows in the delete buffer. The IDs and names are the first two columns. It saves the information in a structure, called str_namelist, of two elements: an integer called id and a string called lastname. The structure was defined previously in the Structure painter. The list of IDs and names is then saved in the file DELETED.TXT:
integer li_fileNum
long ll_deletedrows
str_namelist lstr_namelist[]
ll_deletedrows = dw_1.DeletedCount()
lstr_namelist = &
dw_1.Object.Data.Delete[1,1, ll_deletedrows,2]
li_fileNum = FileOpen("C:/HR/DELETED.TXT", &
LineMode!, Write!)
FOR ll_count = 1 to UpperBound(lstr_namelist)
FileWrite(li_fileNum, &
String(lstr_namelist.id) + &
" " + &
lstr_namelist.lastname + &
"~r~n")
NEXT
FileClose(li_fileNum)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: