Countif in a text box

Stimulsoft Reports.NET discussion
Post Reply
Dwayne
Posts: 7
Joined: Fri Mar 06, 2015 12:24 am

Countif in a text box

Post by Dwayne »

Hi

I have little experience with stimulsoft so i'm not sure if i'm explaining this correctly. I have a list of kitchen cabinet names and I am trying to populate a Expression / Text box only if the cabinet name contains a certain word. Eg if the cabinet name is "wall 2 door" I want Something like this. If Product.Name contains the name "Wall" then it = "Upper cabinet" otherwise It will = "".

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Countif in a text box

Post by Alex K. »

Hello,

Please try to use the following expression:

Code: Select all

{(Product.Name.Contains("Wall") ? "Upper cabinet" : "")}
Thank you.
Dwayne
Posts: 7
Joined: Fri Mar 06, 2015 12:24 am

Re: Countif in a text box

Post by Dwayne »

Thanks for the help

I've tried the code but get the errors that I have attached.

Thanks
Attachments
Error Messages.txt
(467 Bytes) Downloaded 379 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Countif in a text box

Post by Alex K. »

Hello,

Please send us a sample report with test data which reproduce the issue for analysis.
Also please clarify which version are you use?

Thank you.
Dwayne
Posts: 7
Joined: Fri Mar 06, 2015 12:24 am

Re: Countif in a text box

Post by Dwayne »

Hi
I'm not sure what version it is because its wrapped up inside another programme we use called microvellum. I've attached the file and high lighted the formula green

Thanks For your help
Attachments
Assembly Report - 2.mrt
(107.1 KiB) Downloaded 371 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Countif in a text box

Post by HighAley »

Hello.

Please, try to set the Script Language property of the report to CSharp.

Thank you.
Dwayne
Posts: 7
Joined: Fri Mar 06, 2015 12:24 am

Re: Countif in a text box

Post by Dwayne »

Hi
That did the job thanks
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Countif in a text box

Post by Andrew »

Hello, Dwayne.

Thank you for the reply!
Dwayne
Posts: 7
Joined: Fri Mar 06, 2015 12:24 am

Re: Countif in a text box

Post by Dwayne »

Hi
By switching the code from vb to c# I now have an error in my expression box.
This is the what I have in the expression box in a filter on my databand.
ProductsPrompts.Prompts.Name = "Toe_Kick_Height" AND ProductsPrompts.Prompts.Type = 3 AND ProductsPrompts.LinkIDSubassembly = ""
Can this be converted to C#

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Countif in a text box

Post by Alex K. »

Hello,

Please try to use the following expression"

Code: Select all

ProductsPrompts.Prompts.Name == "Toe_Kick_Height" && ProductsPrompts.Prompts.Type == 3 && ProductsPrompts.LinkIDSubassembly == ""
Thank you.
Post Reply