Why you don’t assemble them in one string and then export them
primarily due to then having to process a single string or fixed length.
I need to export in csv format so it can be loaded directly into Excel of office calc.
The other method is to use alternate characters such as ^ or ~ as the delimiters and then open in textpad, find all the commas and remove them, then change all the ~ (tilde) characters to a comma.
I would like to skip that step.
Have you tried XML ports? These open perfectly in Excel.
Except for one off quickies", I try to stay away from dataports where ever possible.
I do not use XML ports for this sort of job, it is, as you describe, a “quickie”.
The answer anyway is:
Desc2 := UPPERCASE(Description);
Desc2 := DELCHR(Desc2,’=’,’,~,^’);
Desc := Desc2;
This does the trick and allows the inclusion of any characters you want to remove.
Thanks for tip re XML.[Y]
Actually I missread what you wanted to do. I thought you wanted to create a CSV file that could ignore the special charachters as CSV markers, but still get that info into Excel.
The problem with this solution is that you will have to strip the , and" off every text field that you export.
I don’t exactly know what this is about, if it’s about dataports or writing to a text file, or if the purpose is to be able to import it to excel, so I’ll just keep it general.
What I’ve found works best for dataports, is to use as field start and end delimiters, and to use as field separators. This way, all other characters can remain in the data, you can have as many " , ; : @ ~ characters as you want, and they will all show up in their right columns.
No extra code necessary, the dataport will work, and excel will have no problem seeing ALL of your data.
Excellent, thank you. I should have spotted that.
K.I.S.S. rules OK!
I used to do somethign similar in earlier versions of Excel, where during the import of a CSV file you could sepcify if the sperator was a comma or a TAB. That option vanished (I think in 2003), and since then I stopped doing it that way. It was the same option that also allowed you to select code pages when importiing a CSV file.
I need to try this, because if it works like you say then this is a great solution.
This is now all part of the text import wizard. You browse to the text file, and from there you enter delimitation or fixed length, data types per column, all that stuff. I like that it’s all in one place, but what I miss (or maybe it’s still there but I can’t find it) is that in office 97 you could save an import profile with those settings, and you didn’t have to enter the same parameters again and again.
If the delimiters and separators are all the same throughout the file then excel picks them up correctly. The problem is that NAV is somehow not able to do it quite completely. Also coming back from Excel, if there are no spaces in a cell value, it doesn’t put “” as delimiters, which confuses NAV going back in, not to mention having those characters as legitimate characters inside field values.
No delimiters and TABs as separators works for both NAV and Excel. I’ve been using it that way for years, and it has never failed me.