Changing @Ans in formula. Arev/OI16/OI32 Specific (OpenInsight 32-bit Specific)
At 28 MAR 2003 05:58:51AM Oystein Reigem wrote:
What's wrong with setting @Ans more than once in a formula? I seem to remember being warned against it.
What I want to do in my formula is first to call the Xref subroutine, then change the result from Xref. But Xref seems to return its value in @Ans, meaning I set @Ans twice in the formula.
My tool is OI32, but I assume the question is equally relevant to the other platforms.
- Oystein -
At 28 MAR 2003 06:42AM [url=http://www.sprezzatura.com" onMouseOver=window.status= Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
The last @Ans to be evaluated will be used - formulae resolve as function calls.
World Leaders in all things RevSoft
At 28 MAR 2003 06:57AM Oystein Reigem wrote:
Sprezzatura,
So there are no side effects of setting @Ans? I assume then if I saw any warnings against setting @Ans more than once in the formula, they were warnings against badly structured programming.
Thanks.
- Oystein -
At 28 MAR 2003 08:54AM Don Miller - C3 Inc. wrote:
Oystein ..
I've seen some badly written symbolics that actually forget that each symbolic call resets @ANS. Even something like:
XX=XLATE("SOMEFILE","SOMEKEY",1,"X") uses @ANS, even though it is internally reset to XX. The last-used @ANS is still hanging around. If multiple calls are being used, I suggest that @ANS be set to null before the call. Sometimes, I use ANS vs @ANS to hold temp values that will be assigned to @ANS at the end.
I think that's the reason.
Don M.
At 28 MAR 2003 09:53AM [url=http://www.sprezzatura.com" onMouseOver=window.status= Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
The scenario we always used to advise against in training is as follows :-
If {FIELD} Then @Ans=A"
If {FIELD2} Then @Ans=B'
As regardless of FIELD or FIELD2 @Ans would be equal to FIELD2.
World Leaders in all things RevSoft
At 28 MAR 2003 12:52PM Oystein Reigem wrote:
Thanks, Don, Sprezz,
Here's how my formula will end up, according to your advice. That's how I would have written it even if I didn't ask for advice. The two @Ans'es shown are the only ones in the formula:
call Xref( … )
Ans=@Ans
…
@Ans=…
- Oystein -