Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex Array and Formatting Issue

Status
Not open for further replies.

BusyBee2012

IS-IT--Management
Oct 10, 2012
2
CA
Hello Everyone,

I have a rather complex Crystal Reports array/formatting issue. Any support is greatly appreciated, my patch work code is quite flawed at the moment. This was orginally completed in 1995 with a much older version of Powerbuilder/Crystal Reports Syntax. I am reformatting using CR8 /Crystal Syntax . My report currently returns 2000 records, based on future date parameters this will be reduced. The fields displayed are:

id
name
Priority#10-50 ...
block#0,1,2,3 ...
dates (to and from)
location
repname

The report is group in the following order :
1 - location
2 - repname
3 - dates

So output looks like:

Ontario
Harrison
Oct 10 to 20
1248389 Mary 10 ,1
1248392 Sarah 20,1
1248393 George 30,1
1248394 Max 40,1
1248399 Harry 50,1

And repeated for each unique grouping, the output I need to see is:

Ontario
Harrison
Oct 10 to 20
1248389, 1248392 to 1248394, 1248399 Mary & Others

The priority numbers 10 - 50 tells me that these id's are related, and block number tells me they can all appear on the same line. However if the block number were different for each id the output would look like:

Ontario
Harrison
Oct 10 to 20
1248389 Mary (this block number would be 1, resulting in priority number 10)
1248392 to 1248394 Sarah & Others (these block numbers would be 2, resulting in priority numbers 20-40)
1248399 Max (this block number would be 3, resulting in priority number 50)

I am working within the constraints of the current system logic. The following code gets me the id's but nothing else such as the sorting suggested by the comments:

local stringvar array myList:={id}; //load the array
Local stringvar temp;
local numbervar i;
local numbervar j;
for i:= 1 to count(myList)-1 do //First loop of the ripple sort
for j:= 1 to count(MyList)-i-1 do //second loop
if MyList[j] > MyList [j+1] then ( //Out of order - swap them
temp := MyList[j];
MyList [j] := MyList [j + 1];
MyList [j+1] := temp;);
join(mylist,", ")

Any thoughts please?? Thank you!!
 
If I had something like that, I'd rewrite it from scratch. Use Crystal's own grouping. Put output in the group footer. Still use variables to collect variables, but without the complications.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Hi Madawc,

Rewriting is not an issue if I achieve the same results. Essentially this problem represents 30% of the orginal query. I was able to resolve the rest using CR8, currently Documentum uses CR8 as an external reporting engine. Using Crystal's own grouping is no problem. However the example above only shows 3 ID's in the range. Sometimes this could actually be more than 50 up to 100, creating a long list.

I am looking for insight into sorting Array data to extract discrete and range values based on a condition to achieve this:

Ontario
Harrison
Oct 10 to 20
1248389, 1248392 to 1248394, 1248399 Mary & Others

Thank you.
 
I avoid arrays in Crytal. Can anyone else help?

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top