I created a WIP at https://wixtoolset.org/development/wips/4948-set-variable-search/ for the SetVariable element that I already implemented for 5539. I don't know whether we want to support setting variables outside of Detect in which case this issue is done.