Maybe a stupid question but might have a big impact if you don't know the result:
What happens with the internal variables of a record if it is called from another object and you do a Clear(rec)? For example:
- SalesLine.Setvar1(True);
- Clear(SalesLine);
Is 'Var1' in the SalesLine record object cleared or is it still set as 'True'?
0
Comments
The answer, as many question are, is "It depends". But in general, the record object is cleared, and all values are cleared.
If you look at all values in the Salesline record object immediately after the CLEAR statement, the values in all fields will be blanks/zeros.
BUT, if you re-read the original sales line record, Var1 will be "True" if there is a MODIFY statement in the "SetVar1" function.
However, if there is no MODIFY, then the re-read of the sales line record will result in whatever value of Var1 was prior to the "SetVar1" function. For example, If it was previously FALSE, then it will return FALSE.
Hope that helps.
But I'm basically referring to non-record fields, like variables, used in the SalesLine object itself. My actual question is: are all variables, used in the object re-set too. (Don't care about the record fields).
So let me try to understand your question. Here's your original example:
- SalesLine.Setvar1(True);
- Clear(SalesLine);
Is 'Var1' in the SalesLine record object cleared or is it still set as 'True'?
Followup questions:
1. In your example, Var1 is a local variable within the Salesline object, but NOT a field in the Salesline record, right?
2. And, there might be additional local variables Var2 and Var3 in the Salesline object as well, right?
Ron
Correct.
I did a small test myself and variables are being cleared correctly.