filter data from Windows Form

hello, as serious to filter data in a report
>

Comments

  • edited 5:28PM
    Hello,

    To filter data in a report, doubleclick the "Data" band and switch to "Filter" tab. You can write any valid .Net expression here.
    For example, in the "Simple List" report you can write the following expression to display employees which name starts with "A":

    [Employees.FirstName].StartsWith("A")
  • edited September 2008
    AlexTZ wrote: »
    Hello,

    To filter data in a report, doubleclick the "Data" band and switch to "Filter" tab. You can write any valid .Net expression here.
    For example, in the "Simple List" report you can write the following expression to display employees which name starts with "A":

    [Employees.FirstName].StartsWith("A")


    if , you put an example in my program creates an order for sale, save, and I've put a button "preview", which is supposed to receive and filter the code of the order for sale, and that makes the second Preview
    - for saying he created the "order of sale number 350 and I want to print it alone, with the format that I designed, of course that such an order covering the entire sheet.
  • edited 5:28PM
    You can define a parameter in your report. To do this:
    - go "Data" window. If it is not visible, you can view it in the "Data|Show Data Window" menu;
    - click "Actions" button in the "Data" window. Select "New Parameter" item;
    - go "Properties" window and set up the DataType and Name properties for the parameter. The DataType property is very important, set it properly.

    To set the parameter in your application:
    report1.SetParameter("myparam", value_for_param);

    To use the parameter in the data filter:
    - set the data band filter to something like this:
    [Employee.FirstName] == [myparam]

  • edited 5:28PM
    AlexTZ wrote: »
    You can define a parameter in your report. To do this:
    - go "Data" window. If it is not visible, you can view it in the "Data|Show Data Window" menu;
    - click "Actions" button in the "Data" window. Select "New Parameter" item;
    - go "Properties" window and set up the DataType and Name properties for the parameter. The DataType property is very important, set it properly.

    To set the parameter in your application:
    report1.SetParameter("myparam", value_for_param);

    To use the parameter in the data filter:
    - set the data band filter to something like this:
    [Employee.FirstName] == [myparam]
    Yes, it's working fine but for small amount of data. What about setting parameter in a where clause? How to do it with some dialog form?

    Regards
    Daniel
  • edited 5:28PM
    Hello,

    In this example:
    - use the in-report datasources (created in the "Data|Add New Data Source..." menu);
    - use the in-report Dialog form to ask a parameter value.

    To do this:
    - add the new dialog form ("Add New Dialog" button on the designer's toolbar);
    - put a TextBoxObject on it (with name "TextBox1");

    - edit your datasource object (in the "Data" window, select the datasource and click "Edit" button);
    - modify your SQL query to use a parameter. For example (MS SQL): "select * from myTable where MyCol = @param1";;
    - go next page of the wizard, setup the parameter's Name, DataType properties (Name should be the same - @param1, DataType depends on MyCol data column type);
    - setup the parameter's Expression property to use the TextBox1.Text value: "TextBox1.Text";
    - setup the parameter's DefaultValue property; it is needed if you want to view datasource's data in the designer.

    Note: you may need to convert the string value returned by TextBox1.Text to appropiate data format. You may use other dialog controls such as DateTimePicker or NumericUpDown.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.