Hi @ all
@Villeroy: Sry I didn't know about your extension, otherways I would have mentioned it of course on
http://extensions.libreoffice.org/ . Charlie pointed me to this thread.
I'm curious about why these "#NV#" values are in the first line. Could you plz post a copy of the database + the used ott-document?
The reason is, that "#NV#"-Values come from these lines only:
Code: Select all
do while oThisResultset.Next
...
...
loop
if oThisResultset.Row=0 then ' empty resultset derived - (first+iStartAtRow line) of the table will be filled with empty strings
...
For ii=1 To ci
myTable.getCellByPosition(ii-1, iStartAtRow).setstring("#NV#")
next ii
end if
The "if" only runs if .row=0 which is as far as I know only possible if there's an empty resultset.
Furthermore, filling of the myTable is stopped after this if block, so (if you didn't use bottom-lines in myTable) there should not be any other lines below the one with the "#NV#".
The first release (v0.1.0) got an update about these '#NV#'-values:
Code: Select all
' optimized filling of table-rows in case of SQL-errors:
' if SQL-Error: "###SQLERROR###", "###ERROR###" or whatever is returned by BRX_eSQL,
' if empty resultset: "#NV#"
Currently if the resultset is empty there's no way to avoid the '#NV#'s using the extension. I might implement that, but the table will then of course stay empty, and in this case it's not clear whether it's empty because there's no record or because the record is empty.
@formatting
I've a version that gets formatted values out of data shown in a base-form (including referred/concatted values from list-fields). The type comes from the recordset and is derived from the field-definitions of the database. This is a bit tricky because I work mainly with MySQL and I just copied the code to use it with the HSQLDB. I did this ~3 years ago, and I think there were no issues - anyway:
1. there are no tests with other backend-databases
2. the code is for exporting data to
calc - this has to be changed of course...
I decided to take the sCellValue = oThisResultset.getstring(n) =>> myTable.getCellByPosition(x,y).setstring(sCellValue) because of a simple idea:
There's just one person on earth that knows exactly what he wants to see in a report - the one that programs it. If he wants "€ 2,50-" out of "2.5" he can manage it - there's no need for another type-conversion-tool (as there exists at least thousands, but not a single one that does exactly what userXYZ needs at a specific moment)