CSV Converter

would be nice to have a collection of examples files of what can be named as “csv files”
then the game is who can import them all the first…

jason I/O too ?

Nice Icon.

(c cedilla) in a header is replaced by two inverted ? (black and white inverted ?; not ).

goes fine in the Row List

I confirm the suspicion; my (modified) header line is now (for testings):
“URL”,"File Name: "
None of the non ASCII characters appears correctly.

I love the design of the edit column window (even if it looks minimalist, I love it).

[quote=191588:@Emile Schwarz]Nice Icon.

ç (c cedilla) in a header is replaced by two inverted ‘?’ (black and white inverted ?; not ¿).

éè’ goes fine in the Row List…

I confirm the suspicion; my (modified) header line is now (for testings):
“URL”,“File Name: éçàèùâêîôûÿŸãñõ”
None of the non ASCII characters appears correctly.

I love the design of the edit column window (even if it looks minimalist, I love it).[/quote]
I am working on this today, it has already been reported (see above). Will you post a test file for me?

All my software has Dragon icons, thank you.

The edit columns page was my third attempt!

Simon.

Set the following line as the first line:

"URL…","File Name: éçàèùâêîôûÿŸãñõ"

If this does not works, use the Keyboard applcation (Control Panel, Keyboard) to know where your base accents are in your key board (sticky Keys) and put them in your testing file.

HTH.

I think I have solved the accented characters issue.

You can download from here:

OS X: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverter.zip
Windows: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverterWIN.zip

The headings I had placed in a structure. Any attempt at changing the encoding compiled but produced no results. I created a new class instead of a structure and it worked! Does anybody know why a string within a structure is different from a string within a class?

Simon.

Emile

I have not used JSON at all but have downloaded the structure/tutorial.

However, it seems to be referencing HTML output and using with Javascript. The input file shows the actual data structures hat are used but I don’t know whether there is any header or footer info in the plain text file. Can you make me a mock-up of a JSON data file so that I can incorporate this?

Thank you.

Simon.

I have had a go at producing a JSON file. I think it is the right structure but would like feedback on this. This is an export only file at present, not import.

You can download from here:

OS X: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverter.zip
Windows: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverterWIN.zip

Simon.

I think I have accented characters sorted.

Now looking for feedback on JSON items.

You can download from here:

OS X: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverter.zip
Windows: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverterWIN.zip

Simon.

It now offers the input filename as the save output filename for consistency.

You can download from here:

OS X: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverter.zip
Windows: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverterWIN.zip

Simon.

Thank you, Axel, most appreciated.

Simon,

diacritical vowels ( to cite a few) works fine with your latest shared application in headings).

Nota: in my projects, I do not have to do anything special to get them displayed correctly in bith headings / core ListBox Rows

Heres the "relevant code:

OpenTIS = TextInputStream.Open(OpenFI) OpenTIS.Encoding = Encodings.UTF8

Then, the code goes into a loop to read a line, deal with its contents and display it in the ListBox, then re-enter the loop.

BTW: I noticed (when ? Before adding the .Encoding line ?) that when used under Windows 8.1, I had encoding troubles (sometimes ? Always ?).

Its been a while since I tested these projects on Windows, so my memory does not serve very well.

Here’s how I dealed with Column (and some other) changes in one of my projects:

The front window comes when the user click in the Set Headings button in the back window. The icons are OS Compliants (change depending on the running OS).

Name: set the typed name
Insert: insert a column and use the set name
Append: add a column “----------------------------”
Move Left / Right moves the column to Left / Right.
Validate: set the changes into the callers window ListBox and close the front window
Close: discard the changes and close the window.

And, just for fun, in another project, instead of NIA, I had NOW (New, Open, Close) but with different Icons ;-:slight_smile:
Thanks for the sharing.

Emile

Thank you for showing me your solution. I think your way is directly linked to your target software and I am looking for a more generic solution.

I only have one more issue that I am struggling with at present; the ability to recognise a line feed or carriage return within a field. I have never come across this need in all the years that I have been working with CSV files but it seems to be an issue. There is a little bit of controversy on this within this thread but I will think about a solution.

Thanks again.

Simon.

You’re right, the shared image was just an idea of how I do that, in my specific case.

I use a double quote (") to encapsulate the fields, so everything inside is displayed as is. I do not expect any LF / CR, etc. in the source files I have to load.

Norman and others says we have to escape any ‘weird’ character (just like LF, CR, comma, etc.).

BTW: beware of strange line endings that can be found here and there. Get an eye to ReplaceLineEndings for more details.

The main issue I see with that possibility is the need to distinguish between end of line and these LF or CR between quotes. That is why I suggested a Regex. Kem Tekinay posted something where he mentioned newline characters, maybe that can help :
https://forum.xojo.com/4565-regex-to-split-tab-delimited-fields/0

I now have carriage returns/linefeeds embedded as long as they are within double quotes. By this I mean that the field that has cr or lf is enclosed with double quotes.

An example of the line is:

"AMERICAN EXPRESS",3742xxxxxxx,0,M,2013-11-05

As long as the field is within double quotes then the parser works as expected. Please try it out.

You can download from here:

OS X: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverter.zip
Windows: https://dl.dropboxusercontent.com/u/10747116/RealStudioClasses/CSVConverterWIN.zip

Simon.

[quote=192100:@Michel Bujardet]The main issue I see with that possibility is the need to distinguish between end of line and these LF or CR between quotes. That is why I suggested a Regex. Kem Tekinay posted something where he mentioned newline characters, maybe that can help :
https://forum.xojo.com/4565-regex-to-split-tab-delimited-fields/0[/quote]
Michel

Yes, you are right.

I have tested it with Windows (cr+lf), Mac (cr) and Unix (lf) files and all are accepted so far.

Simon.

Hi all, the link to dropbox is no longer working. Can we find the code somewhere else?

thanks

gert

[quote=246811:@Gert Van Assche]Hi all, the link to dropbox is no longer working. Can we find the code somewhere else?

thanks

gert[/quote]
Try here:
link text

Simon