开发者

***** instead of truncating a field in Crystal Reports

I was wondering if there was a way in Crystal to do the following:

If a field has a character limit of 10 characters...and the data fed in has 11 characters, instead of showing truncat开发者_运维问答ed data, i'd like it to show **** . Excel has a function like this where if a column is too narrow for a field to show completely, it shows ###### instead of the data.

Is there a way to do this for numeric fields and string fields?

I have tried:

if length {DataTable1.Name} < 4 then {DataTable1.Name} else '****'

also,

if length {DataTable1.Name} > 4 then '*****'

Neither works. Any ideas?


Using Crystal Syntax, this works for me:

If Length({DataTable1.Name}) < 4 Then {DataTable1.Name} Else '****'

Edit:
Since you can possibly have numbers, you'll want something more like this:

If Length(ToText({Command.ORD_NUM_VALUE})) < 4.00 
    Then ToText({Command.ORD_NUM_VALUE}) Else '****'

I get a little wary of casting like this though. Hopefully you can find a better solution for your problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜