Topic: CSV to Flat conversion does not work (1 of 8), Read 21 times
Conf: Wildfile, Other macros
From: Pauli Lindgren
Date: Monday, December 08, 2008 05:49 AM

Has anybody ever tried to use the CSV to Flat conversion?
It does not work at all.

I tried to use the macro with the example file in
http://rosettacode.org/wiki/Column_Aligner

The text uses $ as a field separator.
The macro did not convert a single separator character. However, it tried to convert some of the commas.

I looked at the code and it looks like the separator given in the dialog box is just ignored, it is not used anywhere in the code.

I then converted the $ characters into commas in the file and tried again. But those were not converted either.
Then I added a space after each comma.
Now the first comma on each line was converted into some 70 spaces, and remaining commas on each line were not converted.

By default, the macro sets file type to fixed record length (I wonder why?).
With fixed record length, Vedit defaults to overwrite-only mode, and therefore it is not possible to add the padding spaces.
When I configured Overwrite-only mode to 0, the spaces were added as I told above.
But since the file was in record mode, line was cut in the middle of word.

The line length for record mode was set to the length of the first line. Not even the length of the longest line. So there is no room to pad the fields with spaces.

I then checked the tickbox "Append newlines". (This is quite un-logical. The file already has newlines, so why to append more?)
Now the record mode was not set and line was not cut. But only the first separator on each line was converted as I mentioned above.

--
Pauli

 


Topic: CSV to Flat conversion does not work (2 of 8), Read 20 times
Conf: Wildfile, Other macros
From: Christian Ziemski
Date: Monday, December 08, 2008 05:53 PM

On 12/8/2008 5:49:31 AM, Pauli Lindgren wrote:
>Has anybody ever tried to use the CSV to Flat conversion?
>It does not work at all.

I tried it now the first time. It seems to work.
But not always...

>I tried to use the macro with the example file in
>http://rosettacode.org/wiki/Column_Aligner

>The text uses $ as a field separator.

That's the first problem. The $ doesn't seem to be allowed as delimiter in csv-flat.vdm.

>I looked at the code and it looks like the separator given
>in the dialog box is just ignored, it is not used
>anywhere in the code.

I attached a partly fixed version. It is not finished yet!!!

Perhaps I'll find some time for the macro this evening.


Christian


Edit: old attachment deleted. See new message.

 


Topic: CSV to Flat conversion does not work (5 of 8), Read 18 times, 1 File Attachment
Conf: Wildfile, Other macros
From: Christian Ziemski
Date: Monday, December 08, 2008 06:06 PM


Wow, CSV-FLAT.VDM is really a sophisticated macro...

I think I found and fixed some problems now.

The main problem was that only hardcoded delimiters were allowed. Even if the user provided the correct (but not coded in the macro) delimiter in the dialog it didn't work correctly because the GETPARMS routine wasn't called again to determine several more infos about the data format.

At least that is working now.
Additionally I modified the environment of the DI1() to make sure all parameters are exchanged in+out.

The macro still has some little problems.

I'm not sure how many users are using it since Pauli's message seems to be the first one in three years...
So how much (more) time is reasonable for that macro?
I left my comments in the attached macro for reference for now.

Christian

 
CSV-FLAT(1).VDM (45KB)

 


Topic: Re: CSV to Flat conversion does not work (6 of 8), Read 21 times
Conf: Wildfile, Other macros
From: Ted Green
Date: Monday, December 08, 2008 07:58 PM

At 06:38 PM 12/8/2008, you wrote:
>Wow, CSV-FLAT.VDM is really a sophisticated macro...
>I left my comments in the attached macro for reference for now.

Christian:

Thank you for your work on the macro; we probably only used it with double-quoted and comma delimiters.

Ted.

 


Topic: Re: CSV to Flat conversion does not work (3 of 8), Read 13 times
Conf: Wildfile, Other macros
From: Ted Green
Date: Monday, December 08, 2008 10:52 AM

At 06:03 AM 12/8/2008, you wrote:
>From: "Pauli Lindgren"
>
>Has anybody ever tried to use the CSV to Flat conversion?
>It does not work at all.

We use the Flat to CSV regularly. I don't recall trying the CSV to Flat recently.

Ted.

 


Topic: CSV to Flat conversion does not work (4 of 8), Read 16 times
Conf: Wildfile, Other macros
From: Pauli Lindgren
Date: Monday, December 08, 2008 12:08 PM

On 12/8/2008 5:49:31 AM, Pauli Lindgren wrote:
>
> I tried to use the macro with the example file in
> http://rosettacode.org/wiki/Column_Aligner

I now made a working implementation of the task on the page above.

It is a simple version of csv to flat conversion, so maybe it would give some hints for fixing the macro.
And this implementation has an additional feature to left, center or right align the columns.

I was going to mention on that Rosetta page that Vedit has built-in function to do the formatting. But it seems it does not have it.

--
Pauli

 


Topic: CSV to Flat conversion does not work (7 of 8), Read 18 times
Conf: Wildfile, Other macros
From: Peter Rejto
Date: Wednesday, December 10, 2008 11:40 PM

On 12/8/2008 12:08:02 PM, Pauli Lindgren wrote:
>On 12/8/2008 5:49:31 AM, Pauli Lindgren
>wrote:
>>
>> I tried to use the macro with the example file in
>> http://rosettacode.org/wiki/Column_Aligner

Gentlemen:

Thank you for sharing your ideas with me.
Of course, they are above my head.

However, I did check out the above rosetta URL.
I was surprised to learn that there were 16 examples of the Vedit programing language. I would like to use the Pascal Triangle example of the rosetta URL.

I have a hunch that the program fragment there could be converted to a Pascal.VDM macro. However, I do not know how to do it. So, if somebody could do it for me, I would appreciate it.

Thanks,

-peter.

 


Topic: CSV to Flat conversion does not work (8 of 8), Read 20 times
Conf: Wildfile, Other macros
From: Pauli Lindgren
Date: Friday, December 12, 2008 11:55 AM

On 12/10/2008 11:40:43 PM, Peter Rejto wrote:
>
>Gentlemen:
>
>However, I did check out the above
>rosetta URL.
>I was surprised to learn that there were
>16 examples of the Vedit programing
>language. I would like to use the Pascal
>Triangle example of the rosetta URL.
>
>I have a hunch that the program fragment
>there could be converted to a Pascal.VDM
>macro. However, I do not know how to do
>it. So, if somebody could do it for me,
>I would appreciate it.

There is another thread about Rosetta Code in VEDIT Macro Library section of WebBoard.

Anyway, you do not need to convert the code in any way.
There are two different implementations of Pascal Triangle for Vedit. You can use either one, they are both fully working macros.
Just copy-paste the code into Vedit.
Then either save it as *.vdm file and run it,
or just copy the code in T-Reg 100 and then select
"Misc" -> "Execute macro".
(This is the method I often use to test small macros, no need to save each macro in a separate file.)

--
Pauli