Hi all,
This seems pretty simple, but Im having problems. When I run this program it does not create any records. Basically I am loading a comma delimited file. The delimited file simply holds two columns of data: name and email. I think Im not putting the file in the right format to recognize each line name,email.
sample of delimited file contents: John Johnson,jjohnson@yahoo.com.com,Ben Sharp,bsharp@hotmail.com...
My code
def var v-name as char no-undo.
def var v-email as char no-undo.
def var v-file as char no-undo.
def var v-new-seq as int no-undo.
def var v-cust-number as char no-undo.
assign v-file = "emailist.csv"
v-cust-number = "1112".
INPUT FROM v-file.
REPEAT:
IMPORT DELIMITER "," v-name v-email.
find last contact where
contact.cust-number eq v-cust-number
no-lock no-error.
if avail contact
then assign v-new-seq = contact.seq + 1.
else assign v-new-seq = 1.
create contact.
assign contact.seq = v-new-seq
contact.contact = v-name
contact.cust-number = v-cust-number
contact.email-addr = v-email.
END.
INPUT CLOSE.
This seems pretty simple, but Im having problems. When I run this program it does not create any records. Basically I am loading a comma delimited file. The delimited file simply holds two columns of data: name and email. I think Im not putting the file in the right format to recognize each line name,email.
sample of delimited file contents: John Johnson,jjohnson@yahoo.com.com,Ben Sharp,bsharp@hotmail.com...
My code
def var v-name as char no-undo.
def var v-email as char no-undo.
def var v-file as char no-undo.
def var v-new-seq as int no-undo.
def var v-cust-number as char no-undo.
assign v-file = "emailist.csv"
v-cust-number = "1112".
INPUT FROM v-file.
REPEAT:
IMPORT DELIMITER "," v-name v-email.
find last contact where
contact.cust-number eq v-cust-number
no-lock no-error.
if avail contact
then assign v-new-seq = contact.seq + 1.
else assign v-new-seq = 1.
create contact.
assign contact.seq = v-new-seq
contact.contact = v-name
contact.cust-number = v-cust-number
contact.email-addr = v-email.
END.
INPUT CLOSE.