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)