Page 1 of 1

Reverse a String

Posted: Thu Aug 04, 2011 8:39 am
by Ink
Hi,

Is there a way in a report to reverse a string? I have a string value that represents a date, so 020812 = 2nd Aug 2012
This value is printed as is on one part of the report - 020812
But it is also used as part of a barcode, where it is reversed, so it needs to display as 120802
Is there a way to do this internally in stimulsoft designer?

Thanks,

Jon.

Reverse a String

Posted: Fri Aug 05, 2011 1:34 am
by HighAley
Hello.
Ink wrote:Is there a way in a report to reverse a string? I have a string value that represents a date, so 020812 = 2nd Aug 2012
This value is printed as is on one part of the report - 020812
But it is also used as part of a barcode, where it is reversed, so it needs to display as 120802
Is there a way to do this internally in stimulsoft designer?
If you have a string then please write next expression

Code: Select all

{YourDataSource.YourTextField.Substring(4, 2) + YourDataSource.YourTextField.Substring(2, 2) + YourDataSource.YourTextField.Substring(0, 2)}
If your data in date format then you can use next expression

Code: Select all

{YourDataSource.YourDateField.ToString("yyMMdd")}
Thank you.

Reverse a String

Posted: Fri Aug 05, 2011 2:42 am
by Ink
Thanks! First method worked fine.

Reverse a String

Posted: Fri Aug 05, 2011 5:36 am
by Andrew
Hello,

Perfect! As always we are glad to help you!