SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
help reading a CSV file

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
help reading a CSV file
Author Message
Dominic Klein



Joined: 23 Nov 2001
Posts: 132

Post help reading a CSV file Reply with quote

I have a CSV file of the format :

EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ

The first 2 columns are the email body and subject and will always be there, the problem is that the third can be a number of columns not known but will be separated by semi-colons
eg it could be :
EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ
or
EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY
or
EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ;RECIPIENTA1

how can I read this in using JAL ? Sorry I would normally try and figure it out but this has been thrown upon me and has to be done this weekend and I am desperate,

Fri Jul 05, 2002 11:18 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: help reading a CSV file Reply with quote

Read that file line by line in a loop. Break each line into body, subject and recipient parts and send emails. The example in the on-line help for FileOpen does almost what you want, just insert 3 more lines after FileRead( file_number, recipient )

GetToken(recipient, ",", body)
GetToken(recipient, ",", subject)
replace_all(recipient, ";", ",")

Note that replace_all is a user-defined statement. You can copy it from the "Examples Jobs.dat" file.

Make sure that body and subject do not have commas within their text. If they do you would need more sophisticated solution that the one above.

: I have a CSV file of the format : EMAIL
: BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ

: The first 2 columns are the email body and subject and will always be there,
: the problem is that the third can be a number of columns not known but
: will be separated by semi-colons
: eg it could be : EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ
: or
: EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY
: or
: EMAIL BODY,SUBJECT,RECIPIENTX;RECIPIENTY;RECIPIENTZ;RECIPIENTA1

: how can I read this in using JAL ? Sorry I would normally try and figure it
: out but this has been thrown upon me and has to be done this weekend and I
: am desperate,

Fri Jul 05, 2002 11:45 am View user's profile Send private message
Dominic Klein



Joined: 23 Nov 2001
Posts: 132

Post Re: help reading a CSV file Reply with quote

OK thanks

Fri Jul 05, 2002 12:14 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.