Got it - it’ll take a little while to do a specific example for this (will hopefully have time to take a closer look tomorrow for you!)
For the time being, would this example help you out at all? (Granted, it uses LocalDB rather that Stored variables, but the functionality seems similar?)