variables for import fiellds
Kenneth Brody
kenbrody at spamcop.net
Thu Sep 20 10:24:48 PDT 2012
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