Print Page | Close Window

Three Formula Trick Issue

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22810
Printed Date: 26 Apr 2024 at 12:50pm


Topic: Three Formula Trick Issue
Posted By: jefferydh
Subject: Three Formula Trick Issue
Date 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!



Replies:
Posted By: Sastry
Date 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



Print Page | Close Window