Wildcards in an expression

Stimulsoft Reports.NET discussion
Post Reply
bhodgson
Posts: 10
Joined: Tue Jun 10, 2014 3:08 pm

Wildcards in an expression

Post by bhodgson »

Hi,

Apologies if I'm in the wrong forum, I'm using Stimulsoft Reporting Tool that is integrated into another software package therefore I don't know if .Net is the correct version.

I have a databand which contains a column called Comment - I am trying to create two totals for this column that contains a total of how many occurrences of the word 'training' appears, and another total for how many occurrences of 'sickness' appear. The Comment field may contain other character therefore I am trying to use wildcards to find this, I am using the expression: {Fields.COMMENT == "*training*" ? 1 : 0} - please note I am doing this in the same data band as where the Comment field is located. This hasn't worked as even where the word training does appear, the result is 0 instead of 1.

Once I got the above bit working my plan was to wrap the above statement into a SUM formula to find out the total, something like: {SUM(Fields.COMMENT == "*sickness*" ? 0 : 1)} - but as the first part hasn't worked I haven't tried this part yet.

Can you please help me to first of all use the wildcards effectively and then create a total. Please note I want to locate the above words separately - so whatever I do to find occurrences of the word 'training' I will create a separate expression to find the occurrences of the word 'sickness'.

Thanks,
Any help much appreciated.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Wildcards in an expression

Post by Andrew »

Hello,

The answer depends on the programming language that is used in your report.
By default it's C#. So you should use C# methods. Wildcards don't work this way.
To know that the one string is in the other one you should use next expression:

Code: Select all

Fields.COMMENT.Contains("training")
If you need to count such inclusionыs, you could use next expression

Code: Select all

CountIf(Fields.COMMENT.Contains("sickness"))
P.S. I am sorry for any inconvenience the text below may cause.
According to our support policy we have no permission to provide technical support service for customers of our customers. This is due to that we cannot predict the behavior of our product in the third party component. Some functions may be disabled there and some of them can work a bit another way.
I think it is better for you to send requests to a manufacturer of the software in what our reporting components are integrated.

Thank you for understanding.
Have a nice day!
bhodgson
Posts: 10
Joined: Tue Jun 10, 2014 3:08 pm

Re: Wildcards in an expression

Post by bhodgson »

Thanks for your response - it has worked perfectly.

No problem about the disclaimer, I'm only adding syntax queries to this forum as there is a lot more activity on this forum that the manufacturer of the 3rd party product - but I understand the implications that some things may not work because of the 3rd party product.

Thanks again.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Wildcards in an expression

Post by Andrew »

Thank you for the reply and understanding.

Have a great day!
Post Reply