Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: concatenate multiple fields Post Reply Post New Topic
Author Message
dapark
Newbie
Newbie
Avatar

Joined: 10 Nov 2010
Location: Nicaragua
Online Status: Offline
Posts: 3
Quote dapark Replybullet Topic: concatenate multiple fields
     Posted: 10 Nov 2010 at 8:09pm
I would like to concatenate multiple fields, but I go in single file, the problem is that shows me everything in one column and many rows, I'll give an example:

i would like this record:

1-----P N P N N N P N    

NOT THIS
1----P
2----N
3----P
4----N
...

I used this formula:


stringvar estado := trim({@AUD}) & {@AV} & {@ESP}+' ' +{@EKG}+' ' +{@BHC}+' ' +{@VDRL}+{@EGO}+' ' +{@EGH}+{@P.LIP}+ ' ' +{@CREAT}+' ' +{@TGP}+' ' +{@GLUC}+' ' +{@FR}+' ' +{@hm}+' ' +{@EXF}+' ' +{@COPRO}+' ' +{@RXT}+' ' +{@RX COL};

and i tr with this other formula


stringvar estado := trim({@AUD})& trim({@AV})+' ' +trim({@ESP})+' ' +trim({@EKG})+' '+trim({@BHC})+' ' +trim({@VDRL})
+trim({@EGO})+' ' +trim({@EGH})+trim({@P.LIP})+ ' ' +trim({@CREAT})+' ' +trim({@TGP})+' ' +trim({@GLUC})+' ' +trim({@FR})+' ' +trim({@hm})+' ' +trim({@EXF})
+' ' +trim({@COPRO})+' ' +trim({@RXT})+' ' +trim({@RX COL});
stringvar estado := rtrim({@AUD})+' ' + rtrim({@AV})+' ' +rtrim({@ESP})+' ' +rtrim({@EKG})+' '+rtrim({@BHC})+' ' +rtrim({@VDRL})
+rtrim({@EGO})+' ' +rtrim({@EGH})+rtrim({@P.LIP})+ ' ' +rtrim({@CREAT})+' ' +rtrim({@TGP})+' ' +rtrim({@GLUC})+' ' +rtrim({@FR})+' ' +rtrim({@hm})+' ' +rtrim({@EXF})
+' ' +rtrim({@COPRO})+' ' +rtrim({@RXT})& rtrim({@RX COL});



stringvar estado := rtrim({@AUD})& rtrim({@AV})& rtrim({@ESP})&rtrim({@EKG})& rtrim({@BHC})
& rtrim({@VDRL})
& rtrim({@EGO})
& rtrim({@EGH})
& rtrim({@P.LIP})
& rtrim({@CREAT})
& rtrim({@TGP}) & rtrim({@GLUC}) & rtrim({@FR}) & rtrim({@hm}) & rtrim({@EXF})
& rtrim({@COPRO})
& rtrim({@RXT})
& rtrim({@RX COL});

trim(estado);
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Nov 2010 at 5:03am
I am not sure what the formulas are doing, but from the original example, you want just 1 column displayed horizontally.
 
One way you can accomplish this is to create a group for what you want printed horizontally.  In the details section place a formula like:
shared stringvar sHor;
sHor := sHor + {table.field} + " ";
""  //hides the growing string
 
 
then in the group footer a formula like:
shared stringVar sHor
 
You can display the detail section or not, depends on what else you need to display.
 
HTH
IP IP Logged
dapark
Newbie
Newbie
Avatar

Joined: 10 Nov 2010
Location: Nicaragua
Online Status: Offline
Posts: 3
Quote dapark Replybullet Posted: 11 Nov 2010 at 7:49am
the following formula do this

IF {ReporteBaseEstado;1.Abreviatura} = 'AUD' AND {ReporteBaseEstado;1.IdEstado} = 'P' THEN 'P'
ELSE IF {ReporteBaseEstado;1.Abreviatura} = 'AUD' AND {ReporteBaseEstado;1.IdEstado} = 'N' THEN 'N';

and it will change the " {ReporteBaseEstado;1.Abreviatura} = 'AUD' " in all the formlas that the only thing it changes,
IP IP Logged
dapark
Newbie
Newbie
Avatar

Joined: 10 Nov 2010
Location: Nicaragua
Online Status: Offline
Posts: 3
Quote dapark Replybullet Posted: 11 Nov 2010 at 10:24am
Originally posted by lockwelle

I am not sure what the formulas are doing, but from the original example, you want just 1 column displayed horizontally.
 

One way you can accomplish this is to create a group for what you want printed horizontally.  In the details section place a formula like:

shared stringvar sHor;

sHor := sHor + {table.field} + " ";

""  //hides the growing string

 

 

then in the group footer a formula like:

shared stringVar sHor

 

You can display the detail section or not, depends on what else you need to display.

 

HTH


Hi lockwelle, the code work, but I need to place the records on details section. I'm still tryin to do this

EDIT: Ok i made it finally but i have another issue, this values [p n p n p n p ] them have a title and uhm i need to put them. lol and really i dont have an idea...

Edited by dapark - 11 Nov 2010 at 3:12pm
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum