About neoCSV

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

About neoCSV

Stephane Ducasse-3
Hi sven

I have a question with NeoCVS
Do you offer the possibility to manage the data of one line based on
the description given by the first line

Ex

foo bar baz
1 2 3
11 22 33

=>

res doWith: [:tag :data |
     Transcript show: tag ; space ; show: data printString ;cr
]

foo 1 bar 2 baz 3
foo 11 bar 22 baz 33

Stef

Reply | Threaded
Open this post in threaded view
|

Re: About neoCSV

Sven Van Caekenberghe-2
I am not sure I understand 100% what you want, but consider this example:

(NeoCSVReader on: 'foo bar baz
1 2 3
11 22 33' readStream)
        separator: $ ;
        namedColumnsConfiguration;
        upToEnd.

=> an Array(a Dictionary(#bar->'2' #baz->'3' #foo->'1' ) a Dictionary(#bar->'22' #baz->'33' #foo->'11' ))

Since you did not use $, but space I had to set that using #separator:

#namedColumnsConfiguration uses the header as keys and reads dictionaries instead of arrays.

Instead of #upToEnd you can also iterate with #do:

Is this what you are looking for ?

> On 12 Sep 2017, at 08:23, Stephane Ducasse <[hidden email]> wrote:
>
> Hi sven
>
> I have a question with NeoCVS
> Do you offer the possibility to manage the data of one line based on
> the description given by the first line
>
> Ex
>
> foo bar baz
> 1 2 3
> 11 22 33
>
> =>
>
> res doWith: [:tag :data |
>     Transcript show: tag ; space ; show: data printString ;cr
> ]
>
> foo 1 bar 2 baz 3
> foo 11 bar 22 baz 33
>
> Stef
>


Reply | Threaded
Open this post in threaded view
|

Re: About neoCSV

Stephane Ducasse-3
Yes.
I read all the doc and is it there?
Because yes this is exactly what I was looking for.

On Tue, Sep 12, 2017 at 9:14 AM, Sven Van Caekenberghe <[hidden email]> wrote:

> I am not sure I understand 100% what you want, but consider this example:
>
> (NeoCSVReader on: 'foo bar baz
> 1 2 3
> 11 22 33' readStream)
>         separator: $ ;
>         namedColumnsConfiguration;
>         upToEnd.
>
> => an Array(a Dictionary(#bar->'2' #baz->'3' #foo->'1' ) a Dictionary(#bar->'22' #baz->'33' #foo->'11' ))
>
> Since you did not use $, but space I had to set that using #separator:
>
> #namedColumnsConfiguration uses the header as keys and reads dictionaries instead of arrays.
>
> Instead of #upToEnd you can also iterate with #do:
>
> Is this what you are looking for ?
>
>> On 12 Sep 2017, at 08:23, Stephane Ducasse <[hidden email]> wrote:
>>
>> Hi sven
>>
>> I have a question with NeoCVS
>> Do you offer the possibility to manage the data of one line based on
>> the description given by the first line
>>
>> Ex
>>
>> foo bar baz
>> 1 2 3
>> 11 22 33
>>
>> =>
>>
>> res doWith: [:tag :data |
>>     Transcript show: tag ; space ; show: data printString ;cr
>> ]
>>
>> foo 1 bar 2 baz 3
>> foo 11 bar 22 baz 33
>>
>> Stef
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: About neoCSV

Sven Van Caekenberghe-2
I guess #namedColumnsConfiguration is relatively recent [oct 2015] (although it is just a convenience method, the underlying technology was already there), so it is probably not part of the external docs.
 

>
> On 12 Sep 2017, at 15:26, Stephane Ducasse <[hidden email]> wrote:
>
> Yes.
> I read all the doc and is it there?
> Because yes this is exactly what I was looking for.
>
> On Tue, Sep 12, 2017 at 9:14 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>> I am not sure I understand 100% what you want, but consider this example:
>>
>> (NeoCSVReader on: 'foo bar baz
>> 1 2 3
>> 11 22 33' readStream)
>>        separator: $ ;
>>        namedColumnsConfiguration;
>>        upToEnd.
>>
>> => an Array(a Dictionary(#bar->'2' #baz->'3' #foo->'1' ) a Dictionary(#bar->'22' #baz->'33' #foo->'11' ))
>>
>> Since you did not use $, but space I had to set that using #separator:
>>
>> #namedColumnsConfiguration uses the header as keys and reads dictionaries instead of arrays.
>>
>> Instead of #upToEnd you can also iterate with #do:
>>
>> Is this what you are looking for ?
>>
>>> On 12 Sep 2017, at 08:23, Stephane Ducasse <[hidden email]> wrote:
>>>
>>> Hi sven
>>>
>>> I have a question with NeoCVS
>>> Do you offer the possibility to manage the data of one line based on
>>> the description given by the first line
>>>
>>> Ex
>>>
>>> foo bar baz
>>> 1 2 3
>>> 11 22 33
>>>
>>> =>
>>>
>>> res doWith: [:tag :data |
>>>    Transcript show: tag ; space ; show: data printString ;cr
>>> ]
>>>
>>> foo 1 bar 2 baz 3
>>> foo 11 bar 22 baz 33
>>>
>>> Stef
>>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: About neoCSV

Stephane Ducasse-3
In reply to this post by Stephane Ducasse-3
I'm adding it to the doc

On Tue, Sep 12, 2017 at 3:26 PM, Stephane Ducasse
<[hidden email]> wrote:

> Yes.
> I read all the doc and is it there?
> Because yes this is exactly what I was looking for.
>
> On Tue, Sep 12, 2017 at 9:14 AM, Sven Van Caekenberghe <[hidden email]> wrote:
>> I am not sure I understand 100% what you want, but consider this example:
>>
>> (NeoCSVReader on: 'foo bar baz
>> 1 2 3
>> 11 22 33' readStream)
>>         separator: $ ;
>>         namedColumnsConfiguration;
>>         upToEnd.
>>
>> => an Array(a Dictionary(#bar->'2' #baz->'3' #foo->'1' ) a Dictionary(#bar->'22' #baz->'33' #foo->'11' ))
>>
>> Since you did not use $, but space I had to set that using #separator:
>>
>> #namedColumnsConfiguration uses the header as keys and reads dictionaries instead of arrays.
>>
>> Instead of #upToEnd you can also iterate with #do:
>>
>> Is this what you are looking for ?
>>
>>> On 12 Sep 2017, at 08:23, Stephane Ducasse <[hidden email]> wrote:
>>>
>>> Hi sven
>>>
>>> I have a question with NeoCVS
>>> Do you offer the possibility to manage the data of one line based on
>>> the description given by the first line
>>>
>>> Ex
>>>
>>> foo bar baz
>>> 1 2 3
>>> 11 22 33
>>>
>>> =>
>>>
>>> res doWith: [:tag :data |
>>>     Transcript show: tag ; space ; show: data printString ;cr
>>> ]
>>>
>>> foo 1 bar 2 baz 3
>>> foo 11 bar 22 baz 33
>>>
>>> Stef
>>>
>>
>>