Bob Ino
6th April 2002, 01:32
Greetings to all !

Is there a way to print a comma separated file
from a baan printing device ?

Thanks ! :confused:

Ehabos
8th April 2002, 10:05
Hi Bob,

Using B2Email product, you can send Baan reports in CSV format, and also the in following formats:

1. Rich Text format (to be read by Ms-Word) - RTF
2. Text format (ASCII Mode) - txt
3. BW format (To be read by Baan Client) - BPF
4. HTML format.
5. PDF (to be read by Acrobat Reader) - PDF

And much more... Check the attached file.

Regards,

-Ehab

vaishali
9th May 2002, 17:25
Hi

What is the cost for this product ??

Regards,
vaishali

popeye
9th May 2002, 20:01
Hi,
It's easy to create a CSV file.
Open the file with ".csv" as the extension (abcd.csv) and use
"," as the delimiter.

for e.g. >
fptr = seq.open("abcd.csv", "w")
hold.buffer = field1 & "," & field2 & "," & chr$(10)
ret = seq.write(hold.buffer, fptr)

Hope this helps.
Cheers,
Popeye!

popeye
12th August 2002, 20:34
Hi,
I had a problem while creating a .csv extract file.
One of the fields was Supplier Description, which could
contain a ",".

For example, the Supplier description could have a
description like ABCD ENTERPRISES, INC.
The .csv was considering this as 2 fields instead of 1.
Field 1 = ABCD ENTERPRISES
Field 2 = INC.
Whereas we wanted it as 1 field and not 2.

I managed to solve it.
So .. I thought I'd share it with you guys ...

To avoid this problem pad the description with quotes.

hold.delimit = ","
hold.string.pad = """"

hold.str = tdpur041.suno & hold.delimit &
hold.string.pad & strip$(tccom020.nama) & hold.string.pad & hold.delimit &
strip$(str$(tdpur041.bqua)) & chr$(10)

ret = seq.write(strip$(hold.str), 1024, fptr)

Hope this helps.
Cheers,
Popeye!

NPRao
23rd August 2002, 06:15
This might work too ...


hold.delimit = ","
hold.string.pad = """"

|* hold.str = tdpur041.suno & hold.delimit &
|* hold.string.pad & strip$(tccom020.nama) &
|* hold.string.pad & hold.delimit &
|* strip$(str$(tdpur041.bqua)) & chr$(10)

hold.str = tdpur040.suno & hold.delimit &
quoted.string(tccom020.nama) &
strip$(str$(tdpur041.bqua)) & chr$(10)
ret = seq.write(strip$(hold.str), 1024, fptr)


You might also face an issues with the "," in the totals/amounts like $10,000.00

popeye
23rd August 2002, 20:00
Hi NPR,
Looks like quoted.string() is not available in Baan IV :(
It's cool function to have though.

Thanks.
Cheers,
Popeye!

~Vamsi
23rd August 2002, 23:51
Popeye,

Please write the equivalent function :) and post.

popeye
24th August 2002, 02:18
function string quoted.string(ref string hold.field)
{
return("""" & strip$(hold.field) & """")
}

+++++++++++++++++++++++++++++++++++
Sample Program Script:

domain tcdsca hold.dsca, hold.dsca1

hold.dsca = "dfdfdf,dfdfdf,dfdfd"
hold.dsca1 = quoted.string(hold.dsca)

+++++++++++++++++++++++++++++++++

I am using ref so that I don't have to define a size for hold.field
Note: I am not modifying the value of hold.field in the script
Is there a better way to achieve this?


Cheers,
Popeye!

~Vamsi
24th August 2002, 02:44
Popeye,

You are on the track, but not there yet. According to Baan Help on http://www.baanboard.com/programmers_manual_baanerp_TopicList_Q, the quoting should be single if there are embedded double quotes and vice-versa. I wonder how Baan handles if there are both kind of quotes. So you will have to go quote hunting now :).

popeye
24th August 2002, 02:51
Pardon my ignorance :) But I am not sure what that means.

popeye
24th August 2002, 02:59
I got it ... :)

But then we can't use this function for padding, right?

This is what we need ....
We have a field = abc,jkjkd
We want the .csv to take it as one field and not two separate fields.
Hence we pad it with "".

I don't have access to Baan V ... could somebody verify this for me.

field = abcd'fgfg
quoted.string() would return abcd''fgfg
field = abcd''fgfg
quoted.string() would return abcd''''fgfg

Thanks
Cheers
Popeye!

NPRao
26th August 2002, 20:37
Popeye,

I tested this -


field = abcd'fgfg
quoted.string() would return abcd''fgfg


the field would be "abcd'fgfg".

I think the quoted.string() just, adds quotes at beginning and the end of the string.

I think the function was built just to make it easier to code/understand.