c# - Reportmigration: CrystalReports to SSRS Parameter is applied but not used -
im trying migrate report crystalrreports ssrs. im new reporting , havent worked eighter 1 of reporting systems before.
i have 1 main report, 2 subreports. working correctly , showing desired data. there 2 parameters, allfields-parameter , selectedid-parameter.
allfields tells if empty fields should left out per datarow. selectedid tells datarow has been selected in viewer, report can specific data.
when debug code, correct parameters applied. have absolutely no idea why still processing data, no matter select.
this c# code beneath report:
public hauptformularreportform(datatable themen, gespraechprotokolldao gespraechprotokolldao, grundlagendokumentedao grundlagendokumentedao, bool onlyfilledfiels, int themaid) : this() { themads = new reportdatasource("dataset1", themen); // fill themen display bewertungds = computeandfillbewertungs(themen); // display fields = empty ones reportparameter rp = new reportparameter("allfields", (!onlyfilledfiels).tostring()); // -1 means themen tid = new reportparameter("selectedid", themaid.tostring()); parameterlist = new list<reportparameter>(); parameterlist.add(rp); parameterlist.add(tid); this.crystalreportviewer.localreport.setparameters(parameterlist); this.crystalreportviewer.localreport.datasources.clear(); this.crystalreportviewer.localreport.datasources.add(themads); this.crystalreportviewer.localreport.datasources.add(bewertungds); this.crystalreportviewer.localreport.subreportprocessing += new subreportprocessingeventhandler(setsubdatasource); //this.crystalreportviewer.localreport.refresh(); this.crystalreportviewer.refreshreport(); } public void setsubdatasource(object sender, subreportprocessingeventargs e) { // display fields = empty ones e.datasources.add(themads); e.datasources.add(bewertungds); } /// <summary> /// report display given thema /// </summary> /// <param name="themaid"></param> public void displaysinglethema(int themaid) { tid.values.clear(); tid.values.add(themaid.tostring()); parameterlist.add(tid); } /// <summary> /// compute average bewertungs given themen, /// fill datatable computed averages , use datasource in report. /// </summary> /// <param name="themen"></param> private reportdatasource computeandfillbewertungs(datatable themen) { hauptformularreportdataset.bewertungdatatable bewertungdatatable = new hauptformularreportdataset.bewertungdatatable(); // bewertungs of themen dictionary<int, ilist<ifragewithbewertung>> dictionary = bewertungsextractor.extract(themen); // fill table thema_id , computed bewertung foreach (keyvaluepair<int, ilist<ifragewithbewertung>> themabewertung in dictionary) { hauptformularreportdataset.bewertungrow row = bewertungdatatable.newbewertungrow(); row.thema_id = themabewertung.key; row.bewertungofallfragen = bewertungaveragecomputer.computeaverage(themabewertung.value); row.bewertungoffragenwithstatus = bewertungaveragecomputer.computeaverage(themabewertung.value, true); bewertungdatatable.addbewertungrow(row); } // set datasource in report report.database.tables["bewertung"].setdatasource(bewertungdatatable datatable); return new reportdatasource("dataset2", bewertungdatatable datatable); } }
what have missed or done wrong? why parameter applied correctly (i see correct value in debugger) still not used?
alright, code correct, besides im giving wrong datasources subreports in upper example.
i didnt know filters , werent mentioned when googled problem. anyway working now, stuff needs filtered per report/subreport.
Comments
Post a Comment