Tip of the day! import and an annoying syntax error
fp at casabellagallery.com
fp at casabellagallery.com
Mon Dec 10 06:37:32 PST 2007
Have you ever written a couple of lines of code like:
1 ------- - - - - - - - - - - - - - - - -
LOOP þ If:
Then: import word ref = /tmp/myfile.csv r=\n
2 ------- - - - - - - - - - - - - - - - -
þ If: not ref
Then: show "@Done!"; exit
3 ------- - - - - - - - - - - - - - - - -
þ If: ref(2) eq ""
Then: goto LOOP
4 ------- - - - - - - - - - - - - - - - -
þ If:
Then: lookup new = fp_file@ r=free -e
5 ------- - - - - - - - - - - - - - - - -
þ If:
Then: new(1)=ref(1); write new; close new; goto LOOP
and get a syntax error?
You look at the code and wonder WHAT DA ??? It all looks pretty straight
forward and every line of code is valid - or so you think!
Well, it turns out that ref(2) cannot be referenced on conditional line unless
a ref(###) of equal or greater number is referenced on the action line.
In other words, IF: can ONLY check import fields that are of a numeric position
equal to or less than the highest import field. So, if new(1)=ref(1) was
changed to new(1)=ref(3) or new(1)=ref(2), the error will go away. In the same
token, one could trick filePro and add THEN: aa=ref(2) solely so that one can
check this field.
You know, I'm not even sure if this is a BUG or a TIP :) Heck for now, it
just might be the TIP to kill the BUG.
Regards,
---
Jose Lerebours
954 559 7186
http://www.fpgroups.com
More information about the Filepro-list
mailing list