Three solutions for filtering records in crystal reports ...

zhaozj2021-02-16  55

Directory: First, Solution 1: Report Data Access Using Push Model II, Solution 2: Record the Customized Item 3: Solution 3: Merge parameters to record selected formula -------- -------------------------- Solution 1: Report Data Access Use Push Model

Developers need to write code to connect to the database, perform SQL commands to create records or datasets that match fields in the report, and pass the object to the report. This method allows you to share the connection into the application and filter data before Crystal Reports receives data. ---------------------------------- Solution 2: Record the custom formula to run custom

1, transmission control selection by the viewer formula [Visual Basic] Dim SelectFormula As StringSelectFormula = & textBox1 () TextcrystalReportViewer1.SelectionFormula = SelectFormula [C #] string selectFormula "> {last customer sales.}";. SelectFormula = "{Customer year's sales}> " textBox1.Text; crystalReportViewer1.SelectionFormula = selectFormula; [C ] String * selectFormula; selectFormula-> Concat (". {last customer sales}> ", textBox1-> Text); crystalReportViewer1-> Selectionformula = SELECTFORMULA;

2, passing through a selected report object formula [Visual Basic] Dim selectFormula As StringselectFormula = & textBox1 () TextReport.DataDefinition.RecordSelectionFormula = selectFormula [C #] string selectFormula "> {last customer sales.}";. SelectFormula = "{ Customer. Last year sales}> " textBox1.text; report.datefinition.recordselectionformula = selectformula; [c ] string * selectformula; selectformula-> concat (" {Customer. Last year Sales}> ", TextBox1-> text); Report-> DATADEFINITION-> RecordSelectionformula = SELECTFORMULA; 3, refresh the corresponding report, the method is to end this code using the following code line: CrystalReportViewer1.Refreshreport () This formula is updated, will use the new minimum (previous year sales) ). ---------------------------------- Solution 3: Merge parameters to record selected formula

The parameter field does not have to be placed in the report to be used in the record or group selection formula. Create a parameter field and enter it into the formula as inserted into other fields.

Use the formula to record the output to reduce the amount of data transmitted from the database server and improve performance, simultaneously merge the parameter field to record the selected formula. The following record selection formula is drew user input sales quota and only the last year's sales exceeds the sales quota. {Customer. Last year sales}> {? Salesquota}

Need to write code to transfer the parameter value at runtime ...

转载请注明原文地址:https://www.9cbs.com/read-22472.html

New Post(0)