Thursday, October 19, 2006

Decode Report Explorer and Report Viewer web part

Shppied with Reporting services, there are two sharepoint web part to explorer&view reports:
Report Explorer and Report Viewer
They are connected web part and a little bit difficult to customize them.
let's say, we just want to use report explorer web part to generate a list of all reports, if one of reports being clicked, we want to make another simple web part,webpart1, to print the link being clicked from report explorer.

simple task, isn't it?

but no. there are some tricks behind the click operation.
1. the webpart1 must has a interfacename "RSWebPartInterface_WPQ_", also being registed as report explorer web part.
2. obviousely, webpart1 should implements ICellConsumer interface.
3. Open the source of html generated by report explorer web part, there is an link attached on the report name, which point to a frame, or iframe,it's ID is like "fmViewerg_cb9ac473_a81c_4f76_bc81_df2e41516c0d", the number follows "fmViewer" is the webpart1's ID!

so, report explorer web part just grab the report manager report list page as its inline iframe!
if the page can not find a ifame whose ID is "fmViewer...", it will open another window to show the report,else make the iframe's src as the report link.

that's it.

T-SQL: Update a table from another table(s)

1.
UPDATE TABLE ASET A.FLD_SUPV = ( SELECT B.FLD_SUPVFROM TABLEA A, TABLEB B, TABLEC C,TABLED DWHERE A.FLD1= B.FLD1AND A.FLD_DT >= B.FLD_FM_DTAND A.FLD_DT <= B.FLD_THRU_DTAND A.FLD_DT > D.FLD_THRU_DTAND A.FLD_DT < fld1=" B.FLD1AND">= B.FLD_FM_DTAND A.FLD_DT <= B.FLD_THRU_DTAND A.FLD_DT > D.FLD_THRU_DTAND A.FLD_DT < C.FLD_EFF_DT )

2.
MERGE INTO TABLEA AUSING (SELECT B.FLD_SUPVFROM TABLEB B, TABLEC C,TABLED DWHERE (A.FLD1= B.FLD1AND A.FLD_DT >= B.FLD_FM_DTAND A.FLD_DT <= B.FLD_THRU_DT)AND A.FLD_DT > D.FLD_THRU_DTAND A.FLD_DT < C.FLD_EFF_DT) AS SON 1=1WHEN MATCHED THENUPDATE SET A.FLD_SUPV = S.FLD_SUPV