3

I need to perform a filter to my existing XtraReport and I want to see only some specific records which I have their ID's.

When I execute following code it is applied successfully.

XtraReportOrder report = new XtraReportOrder();
report.FilterString = "orderId IN ('11092', '11093')";
report.ShowPreviewDialog();

I want to use sth like this,

report.FilterString = "orderId IN ("+MyList.ToConvertSthConvinient+")";
husnu
  • 354
  • 3
  • 15
  • 2
    I would consider using [string.join](https://learn.microsoft.com/en-us/dotnet/api/system.string.join?view=netframework-4.8#System_String_Join_System_String_System_Object___) – Cleptus Sep 13 '19 at 11:39

1 Answers1

6

You can use a combination of String.Join, LINQ and the string interpolation feature:

report.FilterString = $"orderId IN ({String.Join(", ", MyList.Select(id => $"'{id}'"))})";
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939