Hello,
I’ve been working on Save csv content in file in WebClient:
plugins.file.writeTXTFile( “report.csv”, ds.getAsText( ‘,’,‘\n’,‘"’,true ), “UTF-8”, “application/vnd.ms-excel”)
If only column_name -all OK
if IFNULL(column_name, “”) -output breaks “[B@49a29040”
Have tried to tweak charsetname and mime-type, but no improvements yet
Should I try with work-around to save file in local and than to stream? Any better idea?
Regards
P.S.
Found sg similar on:
http://groups.google.com/group/servoy-j … e4f398ea03
Note: occurs only on application_server but not in developer
Regards
I doubt the issue is in the File plugin itself…
What is the String produced by your ds.getAsText( ‘,’,‘\n’,‘"’,true ) ?
Thanks for reply Patrick!
Found alternative for IFNULL at MySQL, but that don’t work neither, same dirty output when running on app server: “[B@49a29040”
http://www.webdesignforums.net/threads/ … tive.1413/
Have also done type-dependent branching, but no improvements yet:
if( jsColumn.getType() == jsColumn.INTEGER || jsColumn.getType() == jsColumn.NUMBER )
tmpCol = "(CASE WHEN "+column+" IS NULL THEN 0 ELSE "+column+" END) AS "+column
else if( jsColumn.getType() == jsColumn.DATETIME )
tmpCol = "(CASE WHEN "+column+" IS NULL THEN current_date() ELSE DATE_FORMAT("+column+",'%m/%d/%Y') END) AS "+column
else if( jsColumn.getType() == jsColumn.TEXT )
tmpCol = "(CASE WHEN "+column+" IS NULL THEN '' ELSE "+column+" END) AS "+column
Any further (debugging) ideas?
Regards
Work-around would be not to use IFNULL in query and before writeToFile to
csv = utils.stringReplace(csv,"null","")
but systematic problem with IFNULL() hasn’t been solved yet
Regards