Martin Ryan wrote:Alan Kirk wrote:
Although I haven't tested it, I would expect any process (Variables tab) variables to retain the values that they had from the last row of data when the Epilog is executed...
Coming to this late, but yes, this is the case. For example, when I'm feeling too lazy to run an asciioutput and I want to see how many rows are being processed I can put count=0; in the prolog tab, count=count+1; in the data tab then itemreject(trim(str(count, 10,0))); in the Epilog.
Technically this is dodgy as well. While it does indeed spit an error log containing the item reject information, it's a syntax error rather than a true ItemReject. Neither ItemReject nor ItemSkip have any context in the Epilog tab either since there isn't any "item". I'd rather do an AsciiOutput since at least that way I avoid a bogus error message if I'm triggering the chore manually. (Cue John with a sermon on TI Errors and the relative use/fulness/lesness thereof.

)
It works, but it's not something I'd want the kids to see me doing.
Though in reality I do indeed do a count of how many items are (a) in the data set (b) Have been intentionally rejected (c) have been intentionally skipped and (d) have been processed, and write the whole lot to my control cube.
But we all know that I'm a rivet-counter.
Martin Ryan wrote:
Another point out of the above, is that data held variables can be retained from one iteration of the metadata or data tab to the next.
Variables are not destroyed until the end of the Epilog.
Generally that's true, and in the case of code-defined variables it's always true (the values will carry from one tab to the other), but I was referring to the special case of the variables which are defined on the Variables tab rather than those which are defined within the Advanced tabs.
I decided it was time to test it out to confirm it one way or t'other and have found what others have suggested in this thread... the variables tab variables will ONLY have a value if there is code in the Metadata or Data tabs. This was the part that I wasn't sure about. If you don't have any code in either of those tabs, then the data set will never be iterated, and the variables will never be populated. In such a case what you'll find in the Epilog wouldn't be the values from the last row of data, but rather the "uninitialised" (if I may use the term loosely) values of 0 or an empty string, depending on the data type.
If you DO have code in either of those tabs, then when the Epilog is reached the variables will hold the values that they had from the last row of data in the dataset.
(Tested in 9.0 SP3.)