I need to copy/paste from the query result window into Excel. For results to paste correctly into Excel using "Paste - Use text import wizard" I need to enclose each field in the query result into a delimiter: I use ".
So I need to concatenate " before and each query result, using the || operator. However this operation FAILS for the trailing concatenation for Memo fields of Tagged Values!
For example, the line
'"' || op4.Notes || '"' AS "Remarks",
Produces this result (note no " at the end of the string):
"Constrained by xyz interface
Only the following workaround seems to work (it's kludgy and I need to drop the last character of the memo field to make it work - so I'm looking for a cleaner solution)
'"' || (SUBSTRING(op4.Notes) FROM 1 FOR CHAR_LENGTH(op4.Notes)-1) || '"' AS "Remarks"
The result is then (the trailing collation succeeds but the last character is lost):
"Constrained by xyz interfac"
I checked the Memo fields for non-printing characters or anything that could mess up the collation but cannot find anything strange (actually I clean up the memo string before collation for carriage return and " text that could confuse Excel - my actual query is:
'"' || SUBSTRING(REPLACE (REPLACE (REPLACE (REPLACE (COALESCE(op4.Notes, ''), ASCII_CHAR(13), ' '), ASCII_CHAR(10), '. '), ASCII_CHAR(9), ' '), ASCII_CHAR(34), '''') FROM 1 FOR CHAR_LENGTH(op4.Notes)-1) || '"' AS "Remarks",
I checked Firebird documentation and googled around but cannot find anything related. I suspect it's a EA bug related to Memo fields.
If anyone knows a more elegant solution that does not require me to lose the last character of the field let me know!
p.s. I add a couple spaces when I write the tagged value memos so all that gets cut off is just a space, but it's a chore
I did not have this problem with *.eap Access repositories
I could start messing around with either concatenating a sacrificial character to the string then removing it with SUBSTRING, or adding back the last character after collation or weird stuff like this but before I go down that kludge-fest I'd like to know if there is a better solution!
EA v. 1310
Thanks!