开发者

crystal reports : substring error

I've developed a workaround since crystal reports doesn't seem 开发者_如何转开发to have a substring function with the following formula:

right({_v_hardware.groupname}, truncate(instr(replace({_v_hardware.groupname},".", ","), ","))

What I'm trying to do is search for the period (".") in a string and replace it with a comma. Then find the comma position in the string and print all characters following after the comma. This is assuming the string will only have 1 period in the entire string.

Now when I attempt to do this, I get some weird characters which look like wingdings. Any ideas?

thanks in advance.


I don't know the entire issue that you are attempting to accomplish, but for this question alone, the step of replacing the period with a comma seems to be unnecessary. If you know that there is only one period in the string and you only want the characters right of the period then you should be able to do something like the following (this is @first_formula):

right({_v_hardware.groupname}, len({_v_hardware.groupname}) - instr({_v_hardware.groupname},"."))

If for some reason you want to show the comma then I'd do that in a separate formula. If you need the entire screen with the comma replaced then just do:

replace({_v_hardware.groupname},".",",")

And if you need the comma plus included in the string then it might just be easier to do something like:

"," + {@first_formula}

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜