Crystal Reports: is there a way for regular expression in crystal reports?

I have a crystal report function that requires me to trim characters starting with "-" and delete the rest by following the "-" (dash).

For example, I will have the order number 00000112345-C43-PJ.

How would I just trim everything to the right of the β€œ-” to get the result as 00000112345?

I was looking for a regular expression and a substring, but the crystal does not seem to have these functions.

+4
source share
4 answers

A crystal may not have a regular expression, but it certainly has all the basic string functions

Something like this should do it for you (not verified):

Left({OrderNumber}, InStr({OrderNumber}, "-") - 1) 
+3
source

I recently added the regex library: - https://sourceforge.net/projects/cruflregex/files/

It is a little minimal, but may be useful to someone.

+3
source

This has not been a feature in Crystal reports for a while. I heard that this could be a feature in the latest crystal reports (16?). Check your website and call them, they should not charge a pre-sale question.

Another approach you can take is to manually process the value and check it using the string and isvalue functions, etc. Messier, but it might be a backup option.

0
source

I just posted this on the SAP community network.

http://scn.sap.com/community/crystal-reports/blog/2013/01/31/regular-expressions-within-a-crystal-report

This will certainly not work for everyone, but it is an option.

Noel

0
source

All Articles