How to convert a non-null and not duplicate values from a field in details section into comma-separated formula field at Page header

Hi Experts,
I have multiple records in  a crystal report 11  and of all those records I need to display the result of one field as a comma separated value in the page header.
so if record goes like this in detail section  1   f1
                                                                    2   f1
                                                                    3   ""
                                                                    4   f2
                                                                    5   f1
                                                                    6   f3

then I should display
                              f1,f2,f3
 as a value in the page header. I need to avoid duplicates and empty string value.

Any hint/help would be greatly appreciated.

Thanks
NoorFazAsked:
Who is Participating?
 
mlmccCommented:
To display it in the page header you will have to use a subreport.  I don't know of a summary function that will do what you want.

mlmcc
0
 
vastoCommented:
Yeah, I agree subreport will be the only way to show this in the page header.
You can handle this on the database side too . What is your database type ?
0
 
NoorFazAuthor Commented:
Any other possible way beside sub-report? Is there a way I could built an array whilereadingrecords and display that value on header.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
mlmccCommented:
From what I have read and my experience is that variables only maintain values in the printing pass.

mlmcc
0
 
vastoCommented:
NoorFaz, as I said , you can handle this on database side. What is your database type?
0
 
mlmccCommented:
Are you trying to show for the whole report or just that page?

mlmcc
0
 
NoorFazAuthor Commented:
I wanted to show it for the whole report; I have the following calculated field which is only displaying the first vlaue although When I browse field data on this calculated field it shows set of values like f1;f1,f2;and f1,f2,f3 but its just displaying f1. How can I get hold of last value in this browse list.


whilereadingrecords;
 StringVar ConCat;

if isnull({table.Part}) = false and {table.Part} <> "" then

   ConCat:= ConCat + Trim({table.Part}) + ",";



Left(conCat,Length(ConCat) -1)
0
 
mlmccCommented:
As it finds them it adds the next value.  However the WhilePrintingRecords forces evaluation to the final pass.  The ony value it has in the page header is the first one.  If you put that in the report footer it will probably show the full string assuming the field is large enough.

mlmcc
0
 
NoorFazAuthor Commented:
It is showing right result at the end but not at the page header. Please help.
0
 
mlmccCommented:
That is the way the formula is supposed to work.  It will not be correct until it prints the last record.

Thus the suggestion to use a subreport

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.