filePro quiz -- edits "@"
Mike Schwartz
mschw at athenet.net
Wed Aug 24 09:59:05 PDT 2011
> On 8/22/2011 10:53 AM, Kenneth Brody wrote:
> > Here's a quickie. No fair looking at the list's archives for examples
from me.
> >
> > What does the "@" edits syntax do?
> >
> > Bonus points: write an edit that needs it.
>
> No takers?
>
> The "@" edits syntax matches end-of-field (including trailing spaces).
It's
----- text below is not correctly quoted ----
I left it to somebody else to answer, because in May you gave us a
prime example of how to use the @ in this "urlenc", and I wanted to see if
anybody else had saved it:
>> Without the @, the "accept any amount of any character" part of the edit
>> will accept all of the trailing spaces. Because the "&39;" expansion
>> has increased the number characters in the field, the result no
>> longer fits. By adding the "@" (which must come before the "*"), all
>> of the trailing spaces are consumed, and are not part of the
>> resulting value. Therefore, unless the expanded value is too long to
>> fit, the edit "works". (Consider the case of a field consisting of
>> nothing but apostrophes.) However, using
>> DOEDIT() and passing an explicit length, can work around this.
>
> But you're still not going to get any indication that you may have
> tried to expand off the end of the destination field, as you could
> with a 'function', right?
If the result doesn't pass the destination field's edit, the assignment
fails and the destination is blanked. (I believe that, long ago, this was a
fatal error.) This is true whether it's simply an assignment to a field
with an edit, or the result of the DOEDIT() function.
So, these both result in field "yy" being blank:
xx(50,*) = "Something that fails the 'foo' edit"
yy(50,foo) = xx
and
xx(50,*) = "Something that fails the 'foo' edit"
yy(50,*) = doedit(xx,"foo")
But, there is a difference between these two:
xx(10,*) = "''''''''''"
yy(40,*) = doedit(xx,"urlenc") '' Fails (yy is blanked)
and
xx(10,*) = "''''''''''"
yy(40,*) = doedit(xx,"urlenc","40") '' Succeeds
Ken Brody
----- ----- -----
More information about the Filepro-list
mailing list