variables for import fields
Kenneth Brody
kenbrody at spamcop.net
Thu Sep 20 13:18:48 PDT 2012
On 9/20/2012 2:17 PM, Ryan Powers wrote:
> If I'm following you correctly, then this would work?
>
> MERGEVAL(myimport,600);
> lkup(7) = MERGEVAL(myimport, ct);
>
> I rather doubt that the following would work (being nested), but will give
> it a try if you think it might.
>
> lkup(MERGEVAL(metadata,1)) = MERGEVAL(myimport,ct)
Assuming that "metadata" and "myimport" are both import aliases, and "lkup"
is a lookup...
You need, somewhere in your processing, something like:
' Using '600' because that's what you used. :-)
xx = myimport(600)
This would allow you to use MERGEVAL(myimport,x) for any value "x" up to
600. (Use a more reasonable number if appropriate.)
Next, you should alias an array to the lookup, such as:
dim lkuparray[50]:lkup(1)
At that point, I see no reason why this wouldn't work:
lkuparray[metadata(1)] = mergeval(myimport,ct)
>> -----Original Message-----
>> From: Kenneth Brody [mailto:kenbrody at spamcop.net]
>> Sent: Thursday, September 20, 2012 1:25 PM
>> To: Ryan Powers
>> Cc: filepro-list at lists.celestial.com
>> Subject: Re: variables for import fiellds
>>
>> On 9/20/2012 1:51 AM, Ryan Powers wrote:
>>> I'm trying to do an import of a csv file which may vary in the number
>> of
>>> fields it contains and their order.
>> [...]
>>> ct(4,.0)="1"
>>> fd = metadata(1)
>>> lkup(fd) = myimport(ct); ct=ct+"1";
>>>
>>> The problem is that myimport(ct) fails the syntax check. Is there a
>> function
>>> that I could use?
>>
>> There is an un(der)documented function in 5.7 -- MERGEVAL():
>>
>>> One of the not-yet-fully-documented 5.7 features is a new MERGEVAL()
>> function,
>>> which works similar to FIELDVAL(), except for imports rather than
>> lookups.
>>>
>>> result = MERGEVAL( importname, fieldnum )
>>>
>>> There are some limitations on how it works, due to the way the
>> filePro runtime
>>> engine handles imports.
>>>
>>> As currently implemented, there needs to be a reference, somewhere in
>> the
>>> current processing table, to a hard-coded "importname(nn)", where
>> "nn" is the
>>> highest field number you can access. (The reference need not
>> actually be
>>> executed.) Any reference to a higher number with MERGEVAL() will
>> return a null
>>> string.
>>>
>>> There is currently no equivalent to NUMFIELD() to determine how many
>> fields
>>> were imported for this particular import record. (Remember, the
>> number of
>>> fields in an import record is not necessarily fixed.) You can,
>> however, use
>>> MERGEVAL(importname,"0") to determine the highest field number
>> available, as
>>> determined by the "importname(nn)" reference noted above. This does
>> not mean
>>> that the current import record necessarily had that many fields
>> available. If
>>> you refer to a field which wasn't available on this import record, a
>> blank
>>> value is returned, just as would result with "importname(xx)"
>>>
>>> There is currently no corresponding function for EXPORT.
--
Kenneth Brody
More information about the Filepro-list
mailing list