Solved

Sort shared array using method from mlmcc

Posted on 2011-09-29
10
297 Views
Last Modified: 2012-05-12
I would like to sort the attached report using this method. Is this possible ?
sort order should be the following:
date
client matter
amount

The formula GetShipType uses a shared NumberVar Array.
shared NumberVar Array shipType;
shipType[Int(ToNumber(Right({SOP10200.SOPNUMBE}, 3)))]

Shared variables are evaluated in the last pass ad cannot be used for sorting.

There is a trick that should work.
Make a copy of this report
Edit the copy
   Delete the report header
   Delete the subreport
   Delete the information in the page header
   Save the report as FG-Inventory-Sub

Open the original report
Add a formula to the main report header A
shared NumberVar Array shipType;

Delete the group and all the information in the detail section

Add a formula
Name - @Group1
WhileReadingRecords;
' '

Add a group to the report using that formula
Insert FG-Inventory-Sub report as a subreport in the group header or footer

Suppress the detail section of the main report

mlmcc
report.rpt
0
Comment
Question by:mowit
  • 4
  • 3
  • 3
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 36830804
Did it work?

What is your question?

mlmcc
0
 

Author Comment

by:mowit
ID: 36891161
How do I implement your solution using the attached report is my question.
0
 
LVL 34

Expert Comment

by:James0628
ID: 36896008
Maybe mlmcc can figure it out, but, FWIW, what you posted doesn't really make sense to me.  You've apparently quoted some post that was referring to another report, but without the report, or at least more information, it doesn't really make sense.

 There are formulas using an array variable named shipType, but no indication of how/where/what values are put into that variable.  Then again, the variable isn't actually used anywhere either (in the lines that you posted), so I guess it doesn't matter what's in it.

 There are instructions to make a copy of a report, delete some stuff and use that as a subreport, but without seeing the report, I have no idea what that was supposed to accomplish (What was deleted?  What was left behind?).

 Then it says to create a group in the main report on a formula that only seems to produce one value (""), which seems pretty pointless, and put the subreport in the group header, but without any kind of link between the main report and subreport, so the subreport would presumably produce the same information that the main report used to, minus the deleted things, so that doesn't really seem to accomplish anything.

 So, after all my complaining :-), the upshot is that you really should have included a link to the question that that post came from.  If a solution had been accepted for that question, there should be an "ask a related question" link just above the Comment box at the bottom of the page.  You could use that to create a new question that included a link back to that question for reference.

 As for your report, I looked at it briefly and my first question would be, do you really need those subreports?  The main report and subreports appear to be reading the same tables.  Why do you need the subreports?  Just wanted to ask, before you spend too much time trying to figure out how to sort the report by values stored in shared variable arrays.  If nothing else, it will help us understand how your report works.

 James
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 100

Expert Comment

by:mlmcc
ID: 36896537
Here is the link.  It is from 3 years ago
http://www.experts-exchange.com/Database/Reporting_/Crystal_Reports/Q_23520519.html

I haven't looked at it detail but I honestly can't recall what I was thinking when I provided that answer.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 36900655
Thanks for the pointer.  I looked at it and I don't get it.  :-)  The whole idea is to sort based partly on the values from a shared array variable, but your post doesn't include anything about creating a sort.  It does create a group, but that's based on a formula that only produces one value, so no sorting there.  The only thing I could think of was that maybe the intent was to put the bulk of the main report in a second subreport, and sort the second subreport based on the values put in the array by the first subreport, but that wouldn't work either, would it?

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36900711
As I recall that was the idea.  

The idea does work so long as the array values can be associated with a particular record.  It is the same basic idea that is used for graphing/charting on running totals.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 36901893
OK.  I was thinking that you probably couldn't sort on shared variable values in a subreport either.

 So, getting back to the question at hand, do you think that mowit can use that idea in his report?  I think he's got 3 different arrays that he wants to sort on (date, matter and amount).

 James
0
 

Accepted Solution

by:
mowit earned 0 total points
ID: 36902677
I was thinking. Look at subreport "gather check details" that's populating my arrays, if I change the sort within that subreport will the arrays populate in the correct order ?
0
 

Author Closing Comment

by:mowit
ID: 36935119
worked.
0
 
LVL 34

Expert Comment

by:James0628
ID: 36903762
Were you actually trying to sort the main report, or just sort the values in the arrays?  If you were just trying to sort the arrays, you could use a formula to sort them after the subreport is run, or, as you found, apply the sort in the subreport so that the values are added in the order you want.

 James
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question