Writing to .txt file and importing ,txt file data into excel

Hi,i have a problem writing to text file.

Say for example i have a text field A with values like

11,xxxx

yyyy

zzzz

the above value is nothing but address. i need to export this to text file.

i used the code

StdFields1 = Chr(34) &stringVar &Chr(34)

Print #Filenum, StdFields1

where stringVar contains the field value.

to preserve the values like comma and new line inside field values i used quotes before and after field values.

Now the output in text file looks like

"11,xxxx

yyyy

zzzz"

here the problem is, when it sees the newline in the field, it gets to new line but the value is enclosed in quotes as shown above.

i need to export data to text file in comma delinited value format like

“w” , “eeee” , “11,xxxx yyyy zzzz”

This is a problem for me because, if i import data from text file like this

w" , “eeee” , "11,xxxx

yyyy

zzzz"

into excel, even if i use comma as delimiter, the value yyyy appaers in newline because it appered in newline in text file.

On the whole, If i import the data from the text file to excel, My output in EXCEL should be like

w eeee 11,xxxx yyyy zzzz"

ie. the three values in three cells . the value w in one cell and eeee should be in second cell and “11,xxxx yyyy zzzz” should be in one cell.

Can anyone help me?Thanks in advance

Subject: Writing to .txt file and importing ,txt file data into excel

It sounds like you need to Join() the multiple values in the address field.

dim address as string

address = join( doc.getItemValue( “A” ) )

http://www-12.lotus.com/ldd/doc/domino_notes/6.5.1/help65_designer.nsf/855dc7fcfd5fec9a85256b870069c0ab/7afd58d1915ca23c85256e00004a272a?OpenDocument

Frunobulax

Subject: RE: Writing to .txt file and importing ,txt file data into excel

if address field is text list, then join fn concatenates with delimiter. but in my case, address is text field and not a text list field.

it has a single value but like this

11, xxxx

yyyy

zzzz

join fn is of no use. See this in @implode help. As this is same as join in script.

If you send a single piece of text instead of a list, @Implode returns the text unaltered.

Subject: RE: Writing to .txt file and importing ,txt file data into excel

In that case use the Replace() function to change chr(13)'s and/or chr(10)'s etc into spaces.

Frunobulax

Subject: RE: Writing to .txt file and importing ,txt file data into excel

it worked. Thanks a lot

Subject: Writing to .txt file and importing ,txt file data into excel

create a new field in yr document with the formula

@implode([fldname; " ")

This will create a field with one string

export this field content