dummy value changing in @wbrk1, but not a numeric or subtotal field!

Kenneth Brody kenbrody at bestweb.net
Thu Nov 15 20:02:11 PST 2007


Quoting Brian K. White (Thu, 15 Nov 2007 19:29:01 -0500):

> This one wasted half a day for me so far.
>
> I have a report that wants to send a fax and/or email during @wbrk1
[...]
> iv(255,*,g)=getenv("PFTMP"){"/burst_"{@fi{@rn{@qu{@id{1{"_"{rand(){".pcl"
[...]
> what happens is, in the debugger, stepping through the lines one at a time
[...]
>   action msgbox iv in the debugger shows:
>     /pix/anro/tmp/burst_goinput252504root100013_24140.pcl
>   and the file is created as expected
[... gets to @wbrk1 ...]
>   now msgbox iv shows a new string
>     /pix/anro/tmp/burst_goinput252504root100013_595.pcl
>
> @rn 2525 didn't change, customer number 100013 didn't change, (either in the
> string or in the debugger displaying the fields directly)
>
> The only thing that changed in the string was the random number, and the
> string as a whole changed in a way that as far as I can tell could/should
> only happen if the gosub was run again, because the new string is shorter
> than the previous, yet it was assembled & concattenated correctly as if the
> a{b{c{rand(){d were executed again.
[...]

I believe that you have run into an unexpected side effect of having multiple
copies of dummy fields for each break level.

Consider the typical use for this feature:

     xx = xx + amount

This would give each break level copy of "xx" the total of "amount" for
that particular break level.

In this case, however, the filename is built by combining some literals,
along with the values of @fi, @rn, @qu, @id, field 1, and rand().  Each
copy of iv gets the corresponding copy of these values.  (Of course,
there is only one copy of each of the above fields in this case.  But,
if you were to have built the filename with another dummy field, or
with something like @RS, for example, the result would be more intuitive.)
However, and this is where I believe the unexpected/unintended side effect
comes into play, you also get a separate copy of the value of rand() for
each break level.

-- 
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list