Long String Output

Moderators: Phil Winkler, Graham Smith, Pete Tabord

Long String Output

Postby Neil Moores » Tue Nov 21, 2017 9:51 pm

I’m sure this may be very simple but I have a form which contains serial numbers and I need to output all the serial numbers in one long string with commas in between, so that I can then copy and paste it into another program.

It needs to come out like 123456,785692,128745,389572

I tried the following but it comes out on separate lines:

for CUSTRECORD ;
list records
jointext (SERNO,",")

I also tried the following which sends it to a csv but on separate lines and without any commas.

for CUSTRECORD ;
list records
jointext (SERNO,",")
end
export to "H:\RCweek1.csv" .
.items
@f[1,1]
.end

Ideally if it can work and output to one field in a csv file I could then copy and paste it.

As you have probably gathered I’m not too good at programming. Hope someone can help.
Neil Moores
 
Posts: 110
Joined: Wed Apr 02, 2008 10:14 pm
Has thanked: 2 times
Been thanked: 0 time
 

Re: Long String Output

Postby Mark Nicholas » Tue Nov 21, 2017 11:10 pm

try this :

Code: Select all
define "i" number .
for CUSTRECORD ;
 i := TextOut ( "H:\RCweek1.TXT" , concat ( SERNO , "," ) ) .
end
i := TextOutLN ( "H:\RCweek1.TXT" , "" ) .


saving the output as a .TXT file will enable you to see the commas

saving the output as a .CSV will hide the commas and place each SERNO in a separate column because the comma is seen as a field separator.
Last edited by Mark Nicholas on Tue Nov 21, 2017 11:14 pm, edited 1 time in total.
Mark Nicholas
Mark Nicholas
 
Posts: 120
Joined: Wed Sep 12, 2007 6:56 am
Location: London , UK
Has thanked: 0 time
Been thanked: 1 time
 

Re: Long String Output

Postby Neil Moores » Wed Nov 22, 2017 10:22 am

That worked brilliant Mark - Thank you so much.
Neil Moores
 
Posts: 110
Joined: Wed Apr 02, 2008 10:14 pm
Has thanked: 2 times
Been thanked: 0 time
 

Re: Long String Output

Postby Mark Nicholas » Wed Nov 22, 2017 11:34 am

Thank you for that.

There's one thing I forgot to mention: TextOut and/or TextOutLN will keep adding to the Target File every time you run the procedure.

You therefore need to delete or rename the Target File before running the process again.
Mark Nicholas
Mark Nicholas
 
Posts: 120
Joined: Wed Sep 12, 2007 6:56 am
Location: London , UK
Has thanked: 0 time
Been thanked: 1 time
 

Re: Long String Output

Postby Adrian Jones » Tue Dec 05, 2017 12:12 pm

You can also suppress the newline in the export command by putting a '\' at the end:

.items
@f[1,1]\
.end

Which you could also do in DOS, btw.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 
 

Return to Ffenics 1.x

Who is online

Users browsing this forum: No registered users and 9 guests

cron