Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Part of numeric value highlighted?

Status
Not open for further replies.

nmmure

Programmer
Jun 8, 2006
200
US
Hi,

I am displaying key information on my report. That is numeric value. My user is asking me to highlight last 4 digits.

Using the below formula I break the value into 2 parts and formatted first one to left alignment and second one right alignment. This is working fine.

My report is look like this.
Ex: 1
Customer: United Airways
Fname: Johnson
Acc Key: 234<b>6792</b>
Ex: 2
Customer: AAA Airways
Fname: Johnson
Acc Key: 67845311<b>2341</b>

Upto this, it is fine. User is asking all the values must be in left alignment. Like Ex: 2.
I did couple of ways but not success. Pls guide me any one have idea.

Below formula’s I am using in my report
1)
if Length {1.Acc_key})) <> 0 then
numberVar len := Length ({1.Acc_key}) 4;
left{1.Acc_key}), len)

2)
if Length ({1.Acc_key}) <> 0 then
right({1.Acc_key }, 4)

I am using Crystal report 10 and SQL Server 2000.

Thank You!
Mure

 
You could use "Totext" function to convert your number into a HTML or RTF string, and then use text interpretation.

local stringvar s:=totext({table.value});
left(s,len(s)-4) + "<b>" + right(s,4) + "</b>"

That avoids the need for multiple formulas and text objects.

Editor and Publisher of Crystal Clear
 
Hi,

I appreciate your help.
Using above your formula and the value is printing like below.
4070<b>3928</b>

It is not taking HTML is tags. We need to add anything more ( Setting any properties any object or report side ).

I'm using crystal report 10.

Thanks for your help.

Regards
Mure
 
Mure,

As chelseatech mentioned, you also have to change the "Text Interpretation".

Once the formula is on your report, right-click it, Format Field, Paragraph tab, and pick "HTML Text" for the Text Interpretation choice.

Andy
 
Thanks "chelseatech" and "andymc" for your help.
Now the value printing very nice.

Thank you.
Mure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top