Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Insert the same field twice (continued)

Posted on 2006-05-08
10
Medium Priority
?
241 Views
Last Modified: 2012-06-27
This question follows this one: http://www.experts-exchange.com/Databases/Crystal_Reports/Q_21837369.html

I have a date field in my report and I want it to look like this:

John   12   1/1/01     13   1/3/01
Bill      12   2/1/03
Tom                        13   3/1/04

Is this possible?
Frodoman maybe you can help again?:)

Thanks
0
Comment
Question by:cadkins
  • 6
  • 4
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 16636112
You could try this

Add a group to the report on the NAME field
Add a sort on the number field with the 12s and 13s
Add formulas to the report

In the report header
Name - DeclVars
Formula
Global StringVar G_Footer := '';

In the group header
Name - ResetVars
Formula
Global StringVar G_Footer;
G_Footer := '';

In the group
Name - BuildFooter
Formula
Global StringVar G_Footer;
if {NumberField} = 12 then
   G_Footer := "12     " & {DateField};

if {NumberField} = 13 then
   if G_Footer = '' then
      G_Footer = "               13    " & {DateField}
   else
      G_Footer = G_Footer & "      13    " & {DateField};
''

In the group footer
Name - DispFooter
Formula
Global StringVar G_Footer;
G_Footer

Group footer will have
{NameFIeld}         {@DispFooter}

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16636232
Add WhilePrintingRecords; as the first line of each function

In the report header
Name - DeclVars
Formula
WhilePrintingRecords;
Global StringVar G_Footer := '';

mlmcc
0
 

Author Comment

by:cadkins
ID: 16641026
I did exactly what you told me but it only shows the 12s and their dates.
One other thing. Even if this works my understanding is that everything will be in one column (e.g. 12   1/1/01     13   1/3/01). Is it possible to have 4 columns? I want to export this report to excel and it will be more helpful if that data is in 4 columns instead of 1.

Thanks!
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 101

Accepted Solution

by:
mlmcc earned 1500 total points
ID: 16644827
I believe you are correct about the single column

Try this
Change this formula
Name - BuildFooter
Formula
Global StringVar G_Footer;
if {NumberField} = 12 then
   G_Footer := "12 " & ToText({DateField},"dd/mm/yyyy";

if {NumberField} = 13 then
   if G_Footer = '' then
      G_Footer = "              13 " & ToText({DateField},"dd/mm/yyyy")  '13 spaces before the 13
   else
      G_Footer = G_Footer & " 13 " & ToText({DateField},"dd/mm/yyyy");
''

Add 4 formulas to the group footer

Name - Col1
Formula
WhilePrintingRecords;
Global StringVar G_Footer;
Left(G_Footer,2)

Name - Col2
Formula
WhilePrintingRecords;
Global StringVar G_Footer;
Mid(G_Footer,4,10)

Name - Col3
Formula
WhilePrintingRecords;
Global StringVar G_Footer;
Mid(G_Footer,14,2)

Name - Col4
Formula
WhilePrintingRecords;
Global StringVar G_Footer;
Right(G_Footer,10)

Put those formulas in the footer.

mlmcc
0
 

Author Comment

by:cadkins
ID: 16650277
I get 4 columns now but it still shows only the 12s and their dates(the first 2 columns...3rd and 4th column are always empty).
And something else...i used mm/dd/yyyy and I always get 00 for mm.(eg. 00/12/2004)
Thanks
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16654437
Try MM or nn.  mm may be for minutes

Did you get any 13s in the string or was it always 12 date nothing or just nothing?

Are the 12 and 13 in the same field?

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16654463
Can there be multiple 12s or 13s for a given name?

What SQL are you using?

mlmcc
0
 

Author Comment

by:cadkins
ID: 16660121
MM works fine.
I get 12 & date or nothing (if there is no 12).
12 and 13 are in the same field.
There can be only one 12 and one 13 for a given name.
I am using SQL Server 2000.

Thanks
0
 

Author Comment

by:cadkins
ID: 16663255
I figured out how to do it in a completely different way! I still gave you the points because you tried to help me:)

Thanks!
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 16664060
What worked?

Glad i could help

mlmcc
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Loops Section Overview
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question