计算型域的取值

pinna_angel 2002-11-04 02:58:35
数据窗口中computed field字段在脚本中怎么取值,只是单一合计值.
如果是分组数据窗口又怎么取值?
...全文
17 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhanwei 2002-11-28
  • 打赏
  • 举报
回复
round(double(dw_1.Describe("evaluate('sum(fsumamount)',0)"))
dotnba 2002-11-28
  • 打赏
  • 举报
回复
Description
You can access a single item in a column or computed field by specifying the object name and a row number. You can access all the data in the column by omitting the row number.
Syntax

dwcontrol.Object.columnname {.buffer } {.datasource } { [ rownum ] }

Return value
A single value (for a specific row number) or an array of values (when rownum is omitted). Each value's data type is the data type of columnname.
Usage
Is the expression a DWObject or data? When you want to access all the data in the column, remember to specify at least one of the other optional parameters. Otherwise, the expression you specify refers to the column object, not its data. This expression refers to the DWObject empname, not the data in the column:

dw_1.Object.empname

In contrast, this expressions all refer to data in the empname column:

dw_1.Object.empname.Primary // All rows

dw_1.Object.empname[5] // Row 5

Row numbers for computed fields When you refer to an object in a band other than the detail band (usually a computed field) you still specify a row number. For the header, footer, or summary, specify a row number of 1. For the group header or trailer, specify the group number:

dw_1.Object.avg_cf[1]

If you specify nothing after the computed field name, you refer to the computed field DWObject, not the data. For a computed field that occurs more than once, you can get all values by specifying buffer or datasource instead of rownum, just as for columns.
When the expression is an array When the expression returns an array (because there is no row number), you must assign the result to an array, even if you know there is only one row in the result.

This expression returns an array, even if there is only one row in the DataWindow control:

dw_1.Object.empname.Primary

This expression returns a single value:

dw_1.Object.empname[22]

Examples
Because the default setting is current values in the primary buffer, the following expressions are equivalent梑oth get the value in row 1 for the emp_name column:

dw_1.Object.emp_name[1]

dw_1.Object.emp_name.Primary.Current[1]

This statement sets the emp_name value in row 1 to Wilson:

dw_1.Object.emp_name[1] = "Wilson"

This statement gets values for all the emp_name values that have been retrieved and assigns them to an array of strings:

string ls_namearray[]

ls_namearray = dw_1.Object.emp_name.Current

This statement gets current values of emp_name from all rows in the filter buffer:

string ls_namearray[]

ls_namearray = dw_1.Object.emp_name.Filter

This statement gets original values of emp_name from all rows in the filter buffer:

string ls_namearray[]

ls_namearray = dw_1.Object.emp_name.Filter.Original

This statement gets current values of emp_name from row 14 in the delete buffer:

string ls_name

ls_name = dw_1.Object.emp_name.Delete[14]

This statement gets original values of emp_name from row 14 in the delete buffer:

string ls_name

ls_name = dw_1.Object.emp_name.Delete.Original[14]

This statement gets all the values of the computed field review_date:

string ld_review[]

ld_review = dw_1.Object.review_date.Original

740

社区成员

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

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