Crystal Reports on the web

Looking at the huge number of links, my code snippets and samples that I've accumulated during my journey with Crystal Reports and Report Server (RAS), I've realized that something should be done with all that. So, for all who are struggling with similar problems I've faced while pursuing that elusive goal of putting Crystal Reports on the web, I will put as much information here as I can ...

Thursday, July 27, 2006

Picture function

Ever heard about picture function? No? Me neither until this very morning... No, it's at all not related to images. It's a STRING formating function...

Picture (string, picture)
Basic and Crystal syntax.

Arguments
String is a text string to be formatted according to the picture format.
Picture is a text string representing the way you want the characters in the string to be printed.
Return
string

Action
Picture (string, picture) prints a string or values in a text string in a predetermined format.

Typical Uses
Picture can be used to print a string "2065555555" in a telephone number format "(206) 555-5555", or to print other strings in fixed formats. If you are using a database field as the string, it will only work if the field is of a fixed and known length.

Note: You cannot use an asterisk as a wildcard in the picture argument. If you put an asterisk in the argument, it will show up as an asterisk in the resulting string.

Examples
The following examples are applicable to both Basic and Crystal syntax:

Picture ({customer.FAX},"(xxx) xxx-xxxx" )

Prints the values in the Fax field in the format (805) 555-5555, (313) 555-2555, and so on.

Picture ({customer.REGION}, "[xx]")

Prints the values in the Region field in the format [AK], [CA], and so on.

The size of the string you specify in the picture parameter, that is the number of x's you use, must be greater than or equal to the largest value of the string. So, for example, if you want to print city names in square brackets, you would do the following:

Picture ({customer.CITY}, "[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]")

This would print [Calgary],[Hamilton],[Toronto], and so on. The picture function trims to the size of the data in each row.

Note: The maximum number of x's that can be entered is 252.

Comments
Picture must be enclosed in quotes.
Use the character "x" in the mask to designate characters from the string.
If the database field includes brackets or other formatting, for example (xxx) xxx-xxxx, you will not be able to convert it to xxxxxxx. The parentheses and hyphen will still appear.

Thanks to Experts Exchange Sage called bdreed35 (http://www.experts-exchange.com/M_2620122.html) who pointed that one out...

Experts exchange is good site to find knowledgable people that can help with solving a problem ...
(http://www.experts-exchange.com/Databases/Crystal_Reports/)

5 Comments:

  • At 7:10 AM, Blogger Paul N said…

    How do you include an "x" in the resulting string...

    For example, displaying
    5552121234890

    as
    (555)212-1234 x890

    something like:
    (xxx)xxx-xxxx ?xxxx

    Can this be done?

     
  • At 12:17 PM, Anonymous Anonymous said…

    Inutil

     
  • At 1:28 PM, Anonymous Anonymous said…

    Terrific article! This is the kind of information that are supposed to be shared across the net.
    Disgrace on the seek engines for no longer positioning this publish higher!
    Come on over and visit my web site . Thanks =)
    My webpage : best paying online jobs

     
  • At 1:39 PM, Anonymous Anonymous said…

    It's genuinely very complicated in this full of activity life to listen news on TV, therefore I just use world wide web for that purpose, and take the most up-to-date news.
    Review my website - online freelance writing jobs

     
  • At 5:37 PM, Anonymous Anonymous said…

    Can I simply just say what a relief to uncover somebody
    who genuinely understands what they are talking about on the net.
    You actually understand how to bring a problem to light and make it important.
    More people need to read this and understand this side of your story.
    I can't believe you are not more popular given that you most certainly possess the gift.
    Also visit my blog ; market trading system

     

Post a Comment

<< Home