Make history information accessable to User

I Badly want the following Feature: (extension for flagGenerics isFlagged mechanics)

qc = qc.test1(field)
qc = qc.test2(field)
qc = qc.flagGeneric(field, func: isflagged(field, 'test1') AND isflagged(field, 'test2'))

Where AND can also be any other logical operator. (The logical operator is not the interesting point here of course)

In words: I would like to be able to flag a value in a variable, for example, if and only if two other tests, test1 and test2 where flagging that value.

I guess this shouldnt be to complicated and achievable, by empowering isFlagged to have access to the history, right? I think it would be a great way to get something out of the whole history mechanics.

Background: For the covid Outlier paper, i do something akin: Applying a univariate test to every single variable in a dataset, and than applying a Multivariate test to all of them. At the end, only i want the variables only flagged, where both the tests were triggered. Currently, this is a little complicated (one has to copy all the variables, i think...)

Edited by Bert Palm