Key switch transpose

Hi

I’m try to figure out how I transpose an sample with a keyswitch. I have a sample in a layer and I want to transpose it with an keyswitch like I can with Quick Controls. Any idéas?