mid statement
Jeff Harrison
jeffaharrison at yahoo.com
Fri Nov 18 05:48:07 PST 2005
--- Joe Chasan <joe at magnatechonline.com> wrote:
> 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.
Hmm. I see that I was wrong on this one. I just did
another test and it appears that you can use lookup
fields as the first argument. The syntax check only
crashes when I try to do this and at the same time do
an assignment to the mid statement.
For Example:
mid(dtl[30],"1","7") = "WC80597"
The following works just fine:
aa=mid(dtl[30],"1","7")
So Mia culpa.
>
> > 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.
>
Me too.
Jeff Harrison
jeffaharrison at yahoo.com
Author of JHExport and JHImport. The easiest and
fastest ways to generate code for filePro exports and imports.
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
More information about the Filepro-list
mailing list