Check “Passing parameters to Custom Report Viewer Widget” section of this.
I think it is close to what you need.