Multiable Expressions in Filter Section

Hi,

I'm trying to add this expression to the filter section :

[myTable.starttime] <= [prmDateFrom] && [myTable.endtime] >= [prmDateTo] && If ([prmSourceCall] == "External") {[myTable.is_fromoutside] == false}

It gives me an error CS1200 in Fast Report.

Does filter supports C# syntax? or with some changes?

Thanks,

Comments

  • edited 3:57AM
    Your expression in not correct in C# terms. The expression cannot contain "if" statement.
  • edited 3:57AM
    Hi,

    But I need to validate some passed values from my application to the filter, how can I do that?

    For example if (some parameter = some value) display some specific records.

    Thanks,
  • edited 3:57AM
    The validation code must be placed in the report script. You may use the Report.StartReport event for this purpose.
  • edited 3:57AM
    Ok, one more thing :-)

    Can I set the filter to parameter value? I mean in the filter i set [myParam] then set that parameter from my application:

    report1.SetParameterValue("myParam", CustomExpression);

    I tried this, but it had no effect on the report result.
  • edited November 2008
    Try this way:
          Parameter p = new Parameter("MyParam");
          p.DataType = typeof(bool);
          p.Expression = "a > b";
          Report.Parameters.Add(p);
    
  • edited 3:57AM
    This is my code:

    report1.Load("calllogs.frx"); //load the report
    FastReport.Data.Parameter p = new FastReport.Data.Parameter("sqlQuery");
    p.DataType = typeof(bool);
    string query1 = "[callhistory3.is_fromoutside] == true";
    p.Expression = query1;
    report1.Parameters.Add(p);
    report1.Show();


    and I get this error:
    Exception has been thrown by the target of an invocation.

  • edited 3:57AM
    In my report, I have the "Table" datasource which is used in the "Data" band. I have set the filter for this databand to [MyParam].
    Here is how I pass the parameter:
          FReport.Load(@"d:\untitled.frx");
          Parameter p = new Parameter("MyParam");
          p.DataType = typeof(bool);
          p.Expression = "[Table.RowID] > 100";
          FReport.Parameters.Add(p);
    

    Two things you should be aware of:
    - this code adds a parameter, but does not check if that parameter is exists already;
    - check that parameter's expression is correct, i.e. you are referencing correct data columns or other items. If you make a mistake you may get the runtime error.

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.