import of csv

James Flanagan James at Flantec.com
Sun Dec 3 09:33:37 PST 2017


Filepro 5.7.00.0D94
FreeBSD 

I am trying to write an import routine of csv files where the columns will not be consistent each time.  instead, the header row will determine which column contains which value.  this will become part of a daily routine import, but there will be no way for me to control the column assignments for each file.  

is there any way to refer to the field number of the import with a variable instead of a static number?   Thank you very much, 

file 1: 
first name,last name,…
Mike,Jones,…

file 2
phone number, city, last name,…
555-555-1212,Atlanta,Jones,...


::declare local cnt(6,.0):
::':
::cnt="1":
::fn="/tmp/transfer/"{@pm:
loop::':
::import ascii inf=(fn) r=\n f=~:
:cnt eq "1":po="1";goto get_poc:
:not inf:delete;exit:
::lookup customer r=free -e:
::customer(1)=inf(po):
::close customer:
::cnt=cnt+”1"
::goto loop:
::':
get_poc::':
:inf(po) co “last name":goto loop:
::po=po+"1":
::goto get_poc:
::': 

inf(po) co “last name"
    ^
Process contains a syntax error at position indicated.






James Flanagan
Flantec.com <http://flantec.com/>

email:	James at Flantec.com <mailto:James at Flantec.com>
mobile:	760-458-8498
home: 	219-221-6219
text:		7604588498 at txt.att.net <mailto:7604588498 at txt.att.net>

aim:		Flantec
oovoo:	Flantec
Skype:	Flantec
ichat:	Flantec at mac.com <mailto:Flantec at mac.com>

home:	1901 Cidermill Road
		Michigan City, IN 46360

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20171203/e07cda01/attachment.html>


More information about the Filepro-list mailing list