Hi Philip -
I am not sure I can debug code
But Matt Lloyd walked us through an example at the ASUG BusinessObjects User Conference in late September
Could you check out his presentation here 0509 Power Up your Self-Service BI with Custom ... | ASUG and follow the steps outlined? We successfully deployed this during his session.
Good luck
Tammy