Import Question

Jeff Harrison jeffaharrison at yahoo.com
Mon Sep 21 13:27:05 PDT 2009


--- On Mon, 9/21/09, Brandt Eppler <beppler300 at verizon.net> wrote:

> From: Brandt Eppler <beppler300 at verizon.net>
> Subject: Import Question
> To: filepro-list at lists.celestial.com
> Date: Monday, September 21, 2009, 4:10 PM
> 
> Hi All,
> 
> Can you use a
> variable when defining fields in an import?  
> 
> I
> have a comma delimited file with multiple records on each
> line. The record consist of 4 fields followed by another 4
> fields and again. The lines do not contain the same number
> of records each line is different.. 
> 
> Can I do
> something like this?   It does not seem to work!
> 
> ::fc(2,.0)="1"           
> 'Field Count:
> loop::IMPORT ASCII ref=/tmp/stuff 
> R=\n F=,:
> :not ref:end:
> ::nn(10,*)=ref(fc);fc=fc+"1":
> ::fs(35,*)=ref(fc);fc=fc+"1":
> ::si(10,*)=ref(fc);fc=fc+"1":
> ::us(10,*)=ref(fc);fc=fc+"1":
> ::av(10,*)=ref(fc);fc=fc+"1":
> ::ca(10,*)=ref(fc);fc=fc+"1":
> ::mo(35,*)=ref(fc);fc=fc+"1":
> newrec::lookup new = Server_Details r=free  -n:
> :not
> new:end:
> ::new(1)=nn               
> 'Node:
> ::new(3)=fs               
> 'Filesystem:
> ::new(4)=si                'Size:
> ::new(5)=us                'Used:
> ::new(6)=av                'Avail:
> ::new(7)=ca                '% Cap:
> ::new(8)=mo                'Mounted
> On:
> :ref(fc)="":fc="1";goto
> loop:
> ::goto newrec:
> 
> 
> Thanks for
> any help!!
> 
> Wm. Brandt Eppler, Jr.

Hi Brandt.  I'm not sure why you would want to do what you appear to trying to do here.  However, I believe that the answer is no.  You cannot have an expression as the subscript to the import file alias.  This is actually one of the main reasons that I designed JHImport.

In your case, however, I believe that all you need to do is substitute the following:
 ::nn(10,*)=ref(fc);fc=fc+"1":
 ::fs(35,*)=ref(fc);fc=fc+"1":
(etc.)

with:
 ::nn(10,*)=ref(1):
 ::fs(35,*)=ref(2):
(etc.)

Also remove your references to fc and ref(fc):

Good Luck.

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHImport and JHExport.  The fastest and easiest ways to import and export with filepro.



      


More information about the Filepro-list mailing list