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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

There are 3 fields in a table. for

Status
Not open for further replies.

JavidRaj

Programmer
Nov 10, 2000
9
US
Hi
Pls give me a solution to this problem

There are 3 fields in a table.
for ex

Field1 Filed2

f1text1 F2Text1
f1text2 F2Text2
f1text1 F2Text3
f1text2 F2Text4


I want the report to be look like this

Field1 Field2

f1text1 F2Text1,F2Text3
f1text2 F2Text2,F2Text4

or

Field1 Field2

f1text1 F2Text1
F2Text3

f1text2 F2Text2
F2Text4

how to do this .

thanks in advance for ur help

Raj
 
I am not sure what you are trying to accomplish.

How will the report know that text1 goes with text3 and text2 goes with text4? Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
The easiest way would be to group by Field1, and place Field1 in the group header.
Format this group header to overlay following sections.
Put Field2 in the detail section, to the right of Field1, sorta like the following.

GH1 Field1
D Field2

When you preview it, the GH will overlay the detail section, so it will look like

F1Text1 F2Text1
F2Text3

F1Text2 F2Text2
F2Text4
Malcolm
 
See the answer to the question answered yesterday:
"How to display your results horizontaly" Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hi Ken & Malcom

Thanks for your help and I still have some concerns

My table contains these records(it is actually a view, so it has dublicate records also)

Name City

Andrew Chicago
Bob LA
Andrew Boston
Andrew Chicago
Bob LA

I want the report to be look like this

Name Cities

Andrew Chicago, Boson
Bob LA

or

Name Cities

Andrew Chicago
Boson

Bob LA


Note that there is no dublication in the cities list.

when i do as per malcom's it gives dublicate records.
Like

Name Cities

Andrew Chicago
Boson
Chicago

Bob LA
LA

Eventhough i check the option "suppress if dublicated".

And as per Ken's suggestion
I went thru that thread "How to display your results horizontaly" and i couldn't understand where you wants to do the reset and the formula

I did create a formula by the name
"Resetcities"
with the expression

Global stringVar MyString :=""

and another formula by name
"Allcities"
with the expression
MyString := MyString+" "+{viewname.city}

but it gives error when i save the formula "Allcities". then I declared the stringVar in
the same formula expression itself like
stringVar MyString := MyString+" "+{viewname.city}

but when I try to view it gives an error saying that the string(MyString) exceeds 254
characters

Could you pls help me in these issues

Thanks a lot

Raj
 
A stringVar can't go over 254 anywhere in the report. How many cities will you concatenate?

Group by person and then again by city. put the formula that accumulates the cities on the Group2 footer, so that it only picks up one city.

But if you don't mind the cities list growing vertically it gets much simpler. Follow Malcolm's advice but set up the two groups as I described. Put the city on GH2. It will only print once per city, and the first will be next to the person. Suppress details and GF2.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hi Ken
Thanks a lot for ur help.
Still i have some concerns

The thing is i want some details to be shown in the details section also which is a 3 field in that view. so in that case it first group by name and group by city and show the details section. but it doesn't show all the city names one by one. it shows like

Name : Andrew(which is GH1)
City : Chicago(which is GH2)
detail1(which is detail)

City : Boston
detail2

Name : Bob
City : LA
detail3

but i want like

Name : Andrew
Cities : Chicago
Boston
detail1(which is detail)
detail2

Name : Bob
Cities : LA
detail3

could u help me out to do this.
once again thanks a lot for ur help

 
This is a completely different question. And, unfortunately, there is no easy way to do this because you need to revisit the details of a group that has completed.

A linked subreport could go back and get the details at the end of each Group 1, and list them.

Or (simplest) you could use a Cross-tab by city to summarize the cities at the beginning of each person group, and then print the details for that person. Only one group needed. Take out the grid of the cross-tab and you can get a simple list of cities for each person.

Or you could try using a variable to store the details for the end of the group, as discussed above. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top