Help

3132:16298 -- Handling of incorrect field names

When a field name is wrong in an OpenRPT document, two things happen:
[1] the field is blank when the document is printed,
[2] the renderer emits a qWarning generated by the QSqlQuery::value() method of Qt, but the warning misleadingly states \&amp;quot;QSqlQuery::value: not positioned on a valid record\&amp;quot; instead of \&amp;quot;incorrect field name\&amp;quot;.

The issue [2] could be corrected by the following patch in XSqlQuery::value() method:

QSqlRecord r = record&#40;&#41;;
if &#40;!r.isEmpty&#40;&#41;&#41; &#123;
int i = r.indexOf&#40;name&#41;;
if&#40;i&lt;0&#41; &#123;
qWarning&#40;\&amp;quot;Column \&amp;quot; + name + \&amp;quot; not found in record\&amp;quot;&#41;;
return QVariant&#40;\&amp;quot;\&amp;quot;&#41;;
&#125;
return value&#40;r.indexOf&#40;name&#41;&#41;;
&#125;
&#125;[/code:1:d3d247148f]
That patch should have no side effects, as it only corrects the content of the qWarning that is already emitted.
For issue [1], i''d also like to print some error info - returning \&amp;quot;ERR\&amp;quot; for instance in the XSqlQuery::value() method - to help to diagnose the reports, but as the XSqlQuery class is also used outside of OpenRPT, it could have unwanted side effects.
Any opinions ? -- Read more at http://www.xtuple.org/phpBB2/viewtopic.php?t=3132