Global Variables and Grouping in Crystal
I am pretty new to crystal reports and I am writing a report which is working partially. Now what I am trying to do is as follows.
I have the records grouped by a file number. however there is one field in each record in the group that i want to concatenate into one field divided by commas.
What would be the best way to accomplish this?
what i tried was I created a function that gets called in each group that concatenates the records. However how do i clear the variable so that it changes for each group????
any help would be greatly appreciated.
Thanks.
Re: Global Variables and Grouping in Crystal
I usually do my concatenations in a formula field...
ie.
trim({Agent.Agent_First_Name}) & " " & trim({Agent.Agent_Last_Name})
Re: Global Variables and Grouping in Crystal
This is what I use. Note OrderId is a numeric field (obviously)..
Formula - InitOrderList - placed in Group Header
//initializes and resets the list of orders variable
Global stringVar OrderList :="";
Formula - DisplayOrderList - placed in Group Footer
//concatenates all OrderIds into a comma delimited list.
Global stringVar OrderList;
//a stringVar can has a max length of 256 characters
If Length(OrderList) = 0 Then
OrderList := ToText({Orders.OrderID},0,"")
Else
If Length(OrderList) < 240 Then
OrderList := OrderList + ", " + ToText(length(OrderList),0,"") + ToText({Orders.OrderID},0,"");
OrderList //return List of Orders
Re: Global Variables and Grouping in Crystal
I actually tried that and it doenst seem to be resetting the global variable.
Another interesting thing is that the Second record had the 2 things concatenated and then the first record appends that string with the other string.
Any other ideas????
Re: Global Variables and Grouping in Crystal
You would need to describe your report layout better before I can give anymore advice. Which sections are you using? What is printed in each section?
Re: Global Variables and Grouping in Crystal
I work for a title company.
Here is how my report does.
I am running my report based on a client - showing all the deals that were brought in by a specific client.
now the client could have been a mortgage broker, sellers attorney, buyers attorney etc.. on the file so what i have is alist of title numbers and other information about that file. Then the last column in my report is client type and that says whether it is mortgage broker or client...
Inorder not to bring up the record multiple times in the report I grouped it by title number and then in the group header i display my info about the title number that way for each title number i am just displaying it one time.
Then In that last column I want it to say client, mortgage broker (whatever this specific client is on the file)
Am I being clear?