Group by Expression

Hi, I wanna make a dynamic group using differents fields of a table. Then I create a parameter
in the report and linked it to the expression text of the group; when change the parameter value
via code the group stay the original was setted in the parameter. Why didn't work?

Thanks.

Comments

  • edited 8:50PM
    Hello,

    Please show how you do this. What do you pass in the parameter?
  • dbadba
    edited 8:50PM
    In the code

    report1.SetParameterValue("Grupo", "[Products.Field1]");


    In the designer of the report I have a Group Header with the following condition in the "Edit Group" form:

    Group condition
    Select data column or type an expression
    +
    +
    | [GRUPO] |
    +
    +

    Thanks

  • edited 8:50PM
    That's not correct. You have to set the parameter's Expression property, instead of Value (which is set by SetParameterValue method).
    Correct code:

    Parameter parameter = report1.GetParameter("Grupo");
    parameter.Expression = "[Products.Field1]";
    parameter.DataType = typeof(int); // set correct data type here

    another way is to set the group condition directly:

    GroupHeaderBand group = report1.FindObject("GroupHeader1") as GroupHeaderBand;
    group.Condition = "[Products.Field1]";
  • dbadba
    edited 8:50PM
    Ok, It works....


    Thanks a lot...


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.