Reputation: 2952
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 truncated 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?
Upvotes: 1
Views: 1113
Reputation: 169304
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.
Upvotes: 2