deployment - SSRS RDL Mapping datasources programmatically -
we using rs.exe deployment of rdls reportserver.
as datasource, shared dataset , rdls reside in different folders.after deploying rdls, mapping between rdl shared datasets , shared datasets datasource removed.
i have map each rdl manually respective datasets , datasource. have 200 rdls , it's hard manually.
i need code mapping rdls datasets after deploying rdls
could body code requirement?
i've created rs.exe script performs following:
deploys report based on file report.rdl. report has 1 reference shared data source , 1 reference shared dataset. report deployed report server / directory.
sets data source report existing shared data source on report server. data source deployed /data sources/ds.
set dataset report existing shared dataset on report server. data source deployed /datasets/dataset.
the script contains following code:
public sub main() dim definition [byte]() = nothing dim warnings warning() = nothing 'read report file on disk dim stream filestream = file.openread("report.rdl") definition = new [byte](stream.length - 1) {} stream.read(definition, 0, cint(stream.length)) stream.close() 'deploy report 'itemtype, name, folder, overwrite, definition, properties rs.createcatalogitem("report", "report", "/", true, definition, nothing, warnings) 'update existing report data souce reference shared data source on server dim datasourcerefs(0) datasource dim dsr new datasourcereference dsr.reference = "/data sources/ds" dim ds new datasource ds.item = ctype(dsr, datasourcedefinitionorreference) ds.name = "ds" datasourcerefs(0) = ds rs.setitemdatasources("/report", datasourcerefs) 'update existing report dataset reference shared dataset on server dim datasetrefs(0) itemreference dim dset new itemreference dset.name = "dataset" dset.reference = "/datasets/dataset" datasetrefs(0) = dset rs.setitemreferences("/report", datasetrefs) end sub
it sounds you're deploying reports succesfully.
so, main things note code snippets update data source reference , dataset reference. methods note are:
setitemdatasources update data source.
setitemreferences update dataset.
this 1 report, you'll need wrap code in sub routine deployment script, out.
Comments
Post a Comment