Sunday, February 13, 2011

Wrong argument types for comparison

this is not the first time this piece of code has helped me to get rid
of a weird error:

ERROR:
Error executing code: Wrong argument types for comparison.

Stack trace:
(C) \Classes\QueryRun\next
(C) \Classes\FormDataSource\executeQuery
(C) \Forms\MyForm\Data Sources\MyFormDatasource\Methods\executeQuery - line 4
(C) \Classes\FormDataSource\linkActive
(C) \Forms\MyForm\Data Sources\MyFormDatasource\Methods\linkActive - line 3


SOLUTION:
on the form init,

public void init()
{
super();
this.query().dataSourceNo(1).clearDynalinks();
}

Wednesday, February 9, 2011

Counting how long a job takes

use this code to keep track of how long a piece of code takes to execute

timeofday starttime = timenow();
;
//your cool code here

info(strfmt("Total time taken: %1", time2StrHMS(timenow() - starttime)));