mid statement

Joe Chasan joe at magnatechonline.com
Fri Nov 18 05:31:23 PST 2005


On Thu, Nov 17, 2005 at 07:55:05PM -0800, Jeff Harrison wrote:
> --- Fairlight <fairlite at fairlite.com> wrote:
> 
> > On Thu, Nov 17, 2005 at 04:13:43PM -0800, Todd, the
> > prominent pundit,
> > witicized:
> [snip]
> > > mid(dtl[30],"1","7") = "WC80597"
> > >      ^
> > > Process contains a syntax error at position
> > indicated.
> > > 
> > > Thanks for your help.
> > 
> > Shouldn't that be dtl(30) using parens rather than
> > brackets?  This is a
> > lookup, not an array.  I've never heard they were
> > interchangeable on
> > lookup aliases.
> > 
> > Incidentally, I would personally make sure line 2
> > has a failure test of:
> > 
> > IF:  not dtl
> > THEN:  'handle error condition here
> > 
> [snip]
> 
> I don't think you can use a lookup field as the first
> argument of a mid statement.  I would guess that that
> is what is happening here.  Move the field into a
> dummy field and do the mid on the dummy, then
> re-assign the dummy back to the lookup field.

yes that seems a viable workaround, but as i look at the help
file that comes with my 5.0.14:

"Example:

  MESGBOX "You were born in the year" < mid(InfoFile[5],"7","4")

    The above line gets 4 characters starting in position 7 from
    field 5 in the file named InfoFile."

to me says that it should be possible and having duplicated it
seems to me to be a bug.

> I have seen people use both parentheses and/or
> brackets for lookup fields.  They are aparently
> interchangeable.

for me, its a style issue - lookups always (), and arrays always [].
that way, at a glance i can tell without having to to look earlier in
the table which i am dealing with when looking at older code.
 
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---
-Joe Chasan-                      Magnatech Business Systems, Inc.
joe at magnatechonline.com           Hicksville, NY - USA
http://www.MagnatechOnline.com    Tel.(516) 931-4444/Fax.(516) 931-1264


More information about the Filepro-list mailing list