I have a string field in a database that displays values such as "014086001341" I wish to always have the last four digits to be inserted into a box or other special formatting such as being in Bold or underlined
Arguments
str is a text string.
length is a whole number indicating the number of characters to be extracted from str.
Returns
String value
Action
Extracts the given number of text characters from the right side of the specified string.
Typical uses
Use this function to obtain just the right part of a string. For instance, use it to obtain the last four digits of social security numbers stored in a field.
Examples
The following examples are applicable to both Basic and Crystal syntax:
Right("abcdefg", 3)
Returns "efg".
Right({table.SSNUM}, 4)
Returns the last 4 digits of the social security number as a String.
1) Break the string into two parts using the right and left functions.
Forumula1
StringVar a = Right({yourField}, 4);
Formula2
StringVar a = Left({yourField}, 4); //assuming your number is 8 chars long.
2) In design mode, put a text field into your report. Type this text into the text field: "left + right"
3) Place the two formulas you created in step1 on the page.
4) Make the formula1 bold.
4) Drag formula1 INTO the text field you created and place it on the right side of the plus(+) sign.
5) Delete the text "right" from that text field.
6) Drag formula2 INTO the text field you created and place it on the left side of the plus(+) sign.
7) Delete the text "left" from that text field.
8) Delete the plus(+) sign and any remaining spaces from the text field.
What you will be left with is a text field that sticks two formula values together. You format the formula field before you drag it into the text field and the formatting will hold.
I don't believe that you will be able to format the separate parts once they are combined into the field.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.