Custom report control - method getData()
Hello,
in my custom report control the getData() method is called twice for each record. Report option DoublePass = false. Can I avoid this?
I'm creating a bitmap from some measurement data, so its pretty time consuming.
Best regards
This discussion has been closed.

Comments
Ok, found the reason. getData() is called as many times as the expression array element count. Normally it has two elements - DataColumn and Expression - so its called twice.
Hello!
As you correctly noted, the engine calls `GetData()` to evaluate all of a component’s expressions (`GetExpressions()`) and may also perform layout calculation passes.
To avoid redrawing the resource-intensive Bitmap twice for each record:
Cache the generated Bitmap inside the component (using the string key/field value) and clear the cache only when the data actually changes, rather than on every call to GetData().
Alternatively, generate complex graphics only during the final pass: check if (Report.Engine.FinalPass) (or the readiness flag within BeforePrint / Draw) to ensure that generation does not occur unnecessarily during measurement passes.