×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to display only one field record horizontally in crystal report

How to display only one field record horizontally in crystal report

How to display only one field record horizontally in crystal report

(OP)
Hi all,
I'm very new to this platform but found it very great and hoping someone can help me with my query.

I'm not sure how to ask this question but will give it me best.
I'm writing a report which is displaying a field with multiple values vertically hence duplicating it - example below:

1. John Smith Never smoked
2. John Smith Patient Information and referral to Quitline
3. Neena Pratt Ex-smoker
4. Neena Pratt Patient informed and refused Quitline referral

I want this displayed as:
1. John Smith Never smoked Patient Information and referral to Quitline
2. Neena Pratt Ex-smoker Patient informed and refused Quitline referral

Many thanks

Kofstar
email: kofiattrams@yahoo.com.au

RE: How to display only one field record horizontally in crystal report

The big issue is pulling out the name on the string. There is no reliable way of doing that (First Name-Last Name, Firat Name-Middle Name-Last Name, First Name-Last Name with a space or a hyphen, First Name with a space or hyphen-Last Name, etc.). But if it was not for that then the code below would work.

First formula, goes in the group header.
shared stringvar displaystr := ''; (you could used a global variable, but I like using shared variables)

Second formula, goes in the detail section which is hidden.

shared stringvar displaystr;

if len(displaystr) = 0 then
displaystr := {somestring}
else
displaystr := displaystr + ' ' + {somestring}


last formula, that goes in the group footer.
shared stringvar displaystr;


Of course you would replaced {somestring} with the field value that has the string you want to build.

RE: How to display only one field record horizontally in crystal report

(OP)
Hello Kray,

Big thanks. This worked well. One more thing, any chance of not lumping them together but rather them as separate columns i.e. column 1 column 2 column 3 etc?

RE: How to display only one field record horizontally in crystal report

Well I think there would be a round about way. But you would have to know the maximum number of columns that are needed ahead of time (it would have to be under 100). And the code would be messy.

I am think that you might be able to do an array and some formulas (one for each column, and a couple of support formulas). I have not tried doing it yet.

RE: How to display only one field record horizontally in crystal report

(OP)
Many many thanks, really helped.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close