Domanda

I want to use columns in a function and the columns may differ from time to time. So I want to pass the columns into the function when calling the function, what datatype can be used in the function.

The following is the code that i want to put into the function and compute_page is the column name:

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

Also, I want to do the same thing but this time is set the column value. I tried to use SetItem(), SetText(), SetValue(), but none of the function can achieve the expected result except using dwcontrol.Object.columnname[i] to set the value.

Thanks

È stato utile?

Soluzione

Instead of using the .object notation to access the column, use the GetItemxxx(), eg:

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

Just replace the "compute_page" litteral in the example by a string argument of your function.

Beware that the GetItemxx() call must match the actual column data type, so you need to check for the result of dw_report.describe(ls_your_column_name+".coltype") to call one of GetItemNumber(), GetItemString(), GetItemDecimal(), GetItemDate(), GetItemDatetime() or your application will crash.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top