0

我想在函数中使用列,并且列可能会不时有所不同。所以想在调用函数的时候把列传给函数,函数里面可以使用什么数据类型。

以下是我要放入函数的代码,compute_page是列名:

if dw_report.Object.compute_page[ll_first_row] <> dw_report.Object.compute_page[ll_last_row] then

另外,我想做同样的事情,但这次是设置列值。我尝试使用 SetItem()、SetText()、SetValue(),但除了使用dwcontrol .Object 之外,没有一个函数可以达到预期的结果。columnname [i] 设置值。

谢谢

4

1 回答 1

2

不要使用.object符号来访问列,而是使用GetItemxxx(),例如:

if dw_report.getitemnumber(ll_first_row, "compute_page") <> dw_report.getitemnumber(ll_last_row, "compute_page") then

只需将"compute_page"示例中的文字替换为函数的字符串参数即可。

请注意,GetItemxx()调用必须与实际的列数据类型匹配,因此您需要检查dw_report.describe(ls_your_column_name+".coltype")调用GetItemNumber()GetItemString()GetItemDecimal()、之一的结果GetItemDate()GetItemDatetime()否则您的应用程序将崩溃。

于 2014-02-21T10:10:28.947 回答