Joachim, It works for me:
String streamContents: [ :out | (NeoCSVWriter on: out) addField: #x; addConstantField: String empty; addField: #y; nextPutAll: { 1@2. 3@4 } ]. => '"1","","2" "3","","4" ' What is the value of the instance variable #fieldWriter inside NeoCSVWriter ? It should default to #writeQuotedField: (as set in #initialize). If I am misinterpreting your intentions, please provide a small standalone executable example. Sven > On 24 Dec 2017, at 07:13, jtuc...@objektfabrik.de wrote: > > Sven, > > hmm. The fields I need to write are known not to be written with my > application, so I am lloking for a way to define a field as being an empty > quoted field at all times. > So for I've tried: > > addConstantField: nil --> Exception > addObjectFied: [:a| ] --> empty field without quotes > addConstantField: '' --> empty field without quotes > > So it seems I have to implement some method on my business object that > returns nil and map it to all the fields that need to be empty and quoted. > > > Joachim > > > Am 22.12.17 um 15:48 schrieb Sven Van Caekenberghe: >> Hi Joachim, >> >> nil fields normally write as 'empty quoted fields': >> >> String streamContents: [ :out | (NeoCSVWriter on: out) nextPut: #(nil nil >> nil) ]. >> >> => '"","",""' >> >> Is this not what you want/need ? >> >> Sven >> >>> On 22 Dec 2017, at 15:05, jtuc...@objektfabrik.de wrote: >>> >>> Hi, >>> >>> I need to write a number of empty quoted fields in a CSV export. The >>> receiving application will complain about missing quotes for empty text >>> fields... (don't ask, I've done all the eye rolling for you already) >>> >>> My frst attempt was: >>> >>> writer addConstantField: '""'. >>> >>> >>> But this doesn't write the quotes - I really don't see why, but it's the >>> case. >>> >>> Also, adding >>> >>> writer addObjectField: [:a| '""']. >>> >>> >>> doesn't really work, because it will literally add the double quotes >>> between single quotes... (???) >>> >>> >>> >>> Do I really have to implement some method that returns an empty String on >>> my business objects and use: >>> >>> writer addQuotedField: #justAnEmptyString. ? >>> >>> Am I missing some switch to enable quotes for empty quoted fields? >>> >>> My version of NeoCSVWriter on VA Smalltalk is not actually a current one... >>> >>> >>> >>> Joachim >>> >>> And, btw: Happy Holidays to all of you and a Happy new Year! >>> >>> >>> >>> >>> -- >>> ----------------------------------------------------------------------- >>> Objektfabrik Joachim Tuchel mailto:jtuc...@objektfabrik.de >>> Fliederweg 1 http://www.objektfabrik.de >>> D-71640 Ludwigsburg http://joachimtuchel.wordpress.com >>> Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 >>> >>> >> >> > > -- > ----------------------------------------------------------------------- > Objektfabrik Joachim Tuchel mailto:jtuc...@objektfabrik.de > Fliederweg 1 http://www.objektfabrik.de > D-71640 Ludwigsburg http://joachimtuchel.wordpress.com > Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 > >