Crystal reports: is there a way to regex in crysta

2019-01-25 18:51发布

I have a crystal report function which requires me to trim off characters which start with a "-" and delete the rest following the the "-" (dash).

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

How would I just trim off everything from the right of the "-" get the result as 00000112345?

I looked for a regex and substring but crystal doesn't seem to have these functions available.

4条回答
混吃等死
2楼-- · 2019-01-25 19:26

Crystal might not have regex but it certainly has all the basic string functions

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

Left({OrderNumber}, InStr({OrderNumber}, "-") - 1) 
查看更多
时光不老,我们不散
3楼-- · 2019-01-25 19:31

I've recently added a regex library here:- https://sourceforge.net/projects/cruflregex/files/

It's a bit minimal, but might be of use to someone.

查看更多
聊天终结者
4楼-- · 2019-01-25 19:44

I just posted this over on the SAP Community Network.

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

This certainly won't work for everyone, but it is an option.

Noel

查看更多
欢心
5楼-- · 2019-01-25 19:47

This hasn't been a feature in Crystal reports for a while. I heard it might be a feature in the latest crystal reports (16?). Check out their website and give them a call, they shouldn't charge for a pre-sales question.

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

查看更多
登录 后发表回答