Proper way to access data in a DataSet
This started because we were getting the <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>RHINO USAGE WARNING: Missed Context.javaToJS() conversion:</pre>
in some of our reports, and the result was that in a very short time, we'd see a log file of almost a gig in size. After troubleshooting the issue, it appears that when the report writer accesses our scripted dataset, checking for null in an expression, then the issue happens.<br />
<br />
For example, in our report, if an expression uses the dataSetRow fields directly, and this causes the RHINO USAGE WARNING. <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (dataSetRow["triContract__triStandardContract____triNameTX"] == null) {
"NULL";
} else {
"NOT NULL";
}
</pre>
<br />
But, another developer noted, that if we use a column binding to map the dataSetRow, and the expression utilizes the <strong class='bbc'>row</strong> object instead of the <strong class='bbc'>dataSetRow</strong> object, then there is no expression warning.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (row["triContract__triStandardContract____triNameTX"] == null) {
"NULL";
} else {
"NOT NULL";
}
</pre>
<br />
Our databset doesn't return native types like, <em class='bbc'>int, boolean or String</em>, but rather we return an object type that wraps the native value. (We do this for various reasons, so I won't get into the why, but we can't really change that).<br />
<br />
What I'm seeing though, is that BIRT is not consistent in how it evaluates the expression, and in once case, it generates the RHINO error and in the other, it does not. Is this a bug? Should we ALWAYS use the second method and never access the dataSetRow directly?<br />
<br />
I can attach the 2 sample reports, if you like, although, you can't really run them, since they require our scripted dataset.<br />
<br />
Thanks for any guidance on this.<br />
<br />
Sean.