Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Three Formula Trick Issue Post Reply Post New Topic
Author Message
jefferydh
Newbie
Newbie


Joined: 05 Aug 2019
Online Status: Offline
Posts: 1
Quote jefferydh Replybullet Topic: Three Formula Trick Issue
    Posted: 08 Aug 2019 at 5:48am
I'm an overall novice when it comes to CR, and am having some issues getting results of a field to display on a single line for an individual user.


Essentially I need to report a user's classification (and there can be many) on a single line when their userID pops up for a transaction. I can get it to report on multiple lines when I just use the column that's in the table, however our customer needs it to be separated by comma and not by line.

The classification is generated by a flag on a user's account that is checked off.

My report essentially needs to generates this:

TranDate userID Classification
08/08/19    25     Student, Staff, Hourly Staff
08/08/19    20     Faculty, Student
08/08/19    74     Student, Contractor


However, my current report seems to have taken a mind of its own, and will display like a million flags that aren't actually even checked off on a user's account.

My three part formula looks like this:

@null (Located in Report Header):

   whileprintingrecords;
   stringvar description := "";

@comma_field AKA where I want to actually display the data separated by a comma (location in Details):
   
   whileprintingrecords;
   stringvar description;
   description := description & ", " &    
   {FLAGINFO.DESCRIPTION};

@final (located in Page Footer):

   whileprintingrecords;
   stringvar description;
   Mid(description, 3);


My report is also spitting out a comma at the beginning of the result, should I remove that ", " in there to get it to not do that?

Any help on this would be greatly appreciated! I'm so close to the end of this report, however we absolutely have to have the results on one line, and I just can't seem to get it where it needs to go.

Thanks all!


Edited by jefferydh - 08 Aug 2019 at 6:29am
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 10 Aug 2019 at 12:10am
HI Jeff,

You can remove the comma by writing below statement :

whileprintingrecords;
stringvar description;
Mid(right(description,len(description)-1), 3);

I am not sure why you are using Mid() function here.

If mid() is not required, then use only :
right(description,len(description)-1)
it will remove comma before the line.

Thanks,
Sastry
Thanks,
Sastry
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.