dummy value changing in @wbrk1, but not a numeric or subtotalfield!
Brian K. White
brian at aljex.com
Thu Nov 15 22:16:43 PST 2007
----- Original Message -----
From: "Kenneth Brody" <kenbrody at bestweb.net>
To: "Brian K. White" <brian at aljex.com>
Cc: <filepro-list at lists.celestial.com>
Sent: Thursday, November 15, 2007 11:02 PM
Subject: Re: dummy value changing in @wbrk1, but not a numeric or subtotalfield!
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.
---------------------------------------
(don't know why outlook express isn't quoting)
Oh hohhhh!
So I guess instead of:
longvar = rand()
another way I could fix it (pun intended) is by:
iv = rand() ; iv = iv
Though from an efficiency point of view, maybe the longvar is better anyways (however microscopically) since I don't need multiple copies of this value.
Keeping the comment short to explain why this line must look like one or the other above is going to be a challenge. :)
Thanks much Ken
Brian K. White brian at aljex.com http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
More information about the Filepro-list
mailing list