How to output { in expressions

Stimulsoft Reports.NET discussion
Post Reply
mace242
Posts: 43
Joined: Tue Aug 21, 2007 9:24 am

How to output { in expressions

Post by mace242 »

I want to have an expression that outputs { and also does a calculation. If it was any other character I would do this.

# {SomeCalculation()}

I want to do this

{{SomeCalculation()}}

to output

{100}

is the only way

{"{"+SomeCalculation.ToString()+"}"}?

Thanks.
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

How to output { in expressions

Post by johnham »

Haven't tried this myself but my suggestion would be using the escape operator ("\") like so...

Code: Select all

\{{SomeCalculation()}\}
or try doubling the operator up like so...

Code: Select all

{{{SomeCalculation()}}}
Like I said, I haven't tried either and I haven't got the Report Designer in front of me at this very moment but try those and let me know. I am curious as to what the outcome will be.

Thanks,
John Hamilton
Hamilton & Company, LLC
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

How to output { in expressions

Post by Brendan »

These are the alternatives I know of

Code: Select all

{"{"}{Line}{"}"}

{"{" + Line.ToString() + "}"}

{String.Format("{{{0}}}", Line)}

{Format("{{{0}}}", Line)}

The first one is probably the closest to what you want

Code: Select all

{"{"}{SomeCalculation()}{"}"}
mace242
Posts: 43
Joined: Tue Aug 21, 2007 9:24 am

How to output { in expressions

Post by mace242 »

johnham wrote:Haven't tried this myself but my suggestion would be using the escape operator ("\") like so...

Code: Select all

\{{SomeCalculation()}\}
or try doubling the operator up like so...

Code: Select all

{{{SomeCalculation()}}}
Like I said, I haven't tried either and I haven't got the Report Designer in front of me at this very moment but try those and let me know. I am curious as to what the outcome will be.
I tried both of those and neither works. Just so you know. Thanks for the try anyway.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How to output { in expressions

Post by Edward »

Hello.

Please inform us about version you are using. Have you tried to add above suggestions in the Text property of the report template?

Maybe you trying to do it in run time? In that case please use GetValue event of the StiText component:

e.Value = "{"+5+6+"}";

Thank you.
Post Reply