Help with StiFilterCondition.Containing
-
- Posts: 66
- Joined: Wed Apr 04, 2007 3:32 am
- Location: Spain
Help with StiFilterCondition.Containing
Hi:
Can someone help me with the syntax when creating a StiFilterCondition with the 'Containing' enumeration?
Thanks,
MartinH.
Can someone help me with the syntax when creating a StiFilterCondition with the 'Containing' enumeration?
Thanks,
MartinH.
Help with StiFilterCondition.Containing
You want create filter condition from code in runtime?
Thank you.
Thank you.
-
- Posts: 66
- Joined: Wed Apr 04, 2007 3:32 am
- Location: Spain
Help with StiFilterCondition.Containing
Yes, exactly.Vital wrote:You want create filter condition from code in runtime?
Thank you.
Thanks,
MartinH.
Help with StiFilterCondition.Containing
Code: Select all
using Stimulsoft.Report;
using Stimulsoft.Report.Components;
Code: Select all
StiReport report = new StiReport();
//Assume "myProducts" is a Table containing the columns [ProductID] and [ProductName]
report.Load("C:\\ProductList.mrt");
report.RegData("Products", myProducts);
StiDataBand myBand = report.GetComponentByName("DataBand1") as StiDataBand;
if(myBand != null)
{
//Show Products where ProductName contains the word "Shoe"
StiFilter myFilter = new StiFilter("ProductName", StiFilterCondition.Containing, "Shoe", StiFilterDataType.String);
myBand.Filters.Add(myFilter);
}
rpt.Show();
-
- Posts: 66
- Joined: Wed Apr 04, 2007 3:32 am
- Location: Spain
Help with StiFilterCondition.Containing
Brendan:
Thanks for the valuable information.
Just one more question. Does StimulReports allow for grouped filter conditions?
By this I mean something like this: '(Code >= 1 and Code = 100 and Code <= 109)'
You can see there are 'and' conditions a well as an 'or' condition. Is this possible? If so how?
Thanks,
MartinH.
Thanks for the valuable information.
Just one more question. Does StimulReports allow for grouped filter conditions?
By this I mean something like this: '(Code >= 1 and Code = 100 and Code <= 109)'
You can see there are 'and' conditions a well as an 'or' condition. Is this possible? If so how?
Thanks,
MartinH.
Help with StiFilterCondition.Containing
Yes, in this case you could do one of the following:
1) Use a Between FilterCondition
2) Use 2 Filter Conditions. One for GreaterThanOrEqualTo and a second one for a LessThanOrEqualTo
1) Use a Between FilterCondition
2) Using 2 Filter Conditions
1) Use a Between FilterCondition
2) Use 2 Filter Conditions. One for GreaterThanOrEqualTo and a second one for a LessThanOrEqualTo
1) Use a Between FilterCondition
Code: Select all
//Filter Code between the Values of 1 and 9
StiFilter myFilter = new StiFilter("Code", StiFilterCondition.Between, "1", "9", StiFilterDataType.Numeric);
myBand.Filters.Add(myFilter);
2) Using 2 Filter Conditions
Code: Select all
//Filter Codes with Values Greater than or equal to 100
StiFilter myFilter1 = new StiFilter("ProductID", StiFilterCondition.GreaterThanOrEqualTo, "100", StiFilterDataType.Numeric);
myBand.Filters.Add(myFilter1);
//Filter Codes with Values Less than or Equal to 109
StiFilter myFilter2 = new StiFilter("ProductID", StiFilterCondition.LessThanOrEqualTo, "109", StiFilterDataType.Numeric);
myBand.Filters.Add(myFilter2);
Help with StiFilterCondition.Containing
Please use expression instead of Value in the Field Is dialog Box.
Thank you.
Thank you.
Help with StiFilterCondition.Containing
Oops Sorry,
I misread your question. In the example you gave you could use an Expression Filter to accomplish that task or you can use 2 filters and set the FilterMode Property of the DataBand
I misread your question. In the example you gave you could use an Expression Filter to accomplish that task or you can use 2 filters and set the FilterMode Property of the DataBand
Code: Select all
myBand.FilterMode = StiFilterMode.Or;
Help with StiFilterCondition.Containing
Yes, it is the correct way.
An Expression you can find in the Designer. Default value is Value in the Field Is combobox.
Thank you.
An Expression you can find in the Designer. Default value is Value in the Field Is combobox.
Thank you.
Help with StiFilterCondition.Containing
You also may use the following code:
Thank you.
Code: Select all
StiFilter myFilter = new StiFilter("((Code >= 1) && (Code = 40) && (Code <= 109))");